Can I add PHP extensions on a shared server?

Hello,

My web hosting company tells me that they will not enable the mysqli extension on my shared server just for me.  I would rather not have to go through all my files and change the mysqli_s to mysql_s.  Is there any way that I can edit php.ini or whatever and install the mysqli.dll in my public html directory and get it working?

Thanks
deafpandaAsked:
Who is Participating?
 
Beverley PortlockConnect With a Mentor Commented:
The extension_dir setting is used to change the folder in which all the relevant DLLs needed for the extension reside. Changing it is usually a bad idea. After changing php.ini Apache needs restarting - can you do that?

Have a look through these, they may give some suggestions of what to try

http://uk2.php.net/manual/en/mysqli.installation.php

http://uk2.php.net/manual/en/faq.installation.php#faq.installation.addtopath

http://uk2.php.net/manual/en/install.windows.manual.php
0
 
Beverley PortlockCommented:
Chances are that you'll have to do without mysqli. Even if you could enable it through a .htaccess (and you cannot) then if your provider has not loaded the required libraries it won't work.
0
 
hampus_bCommented:
You can use override_function and override all the mysqli_ functions with mysql_ functions. Do this in a separate file, and just include it in your files...

See http://se.php.net/override_function

//hampus
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
deafpandaAuthor Commented:
Thanks for your responses.

There is a php.ini file in my public html folder.  Can I not somewhere in this file tell PHP to look for extensions in a different folder, and then create a folder in my part of the shared server and install the mysqli extension there?

Thanks
0
 
deafpandaAuthor Commented:
Hampus: I tried using your method which looks promising but I get the error "call to undefined function override_function".

Any idea why?

Thanks
0
 
Beverley PortlockCommented:
The PHP.INI is exactly where the mysqli interface would be activated. Go down to find a section called [Extensions] and add

extension=mysqli.dll   (on windows, for linux it's ".so" instead of ".dll")

and restart apache. What I find odd is the hoster's comment that they will not enable it. I took that to mean it was not installed and  you where not getting it. It coud have just meant you have to do it yourself which seems very unhelpful of them.

Try it and see. If it does not work you can just remove the line you added. Trying it shouldn't do any harm. If there are existing lines such as extension=mysql.dll then LEAVE THEM ALONE.
0
 
deafpandaAuthor Commented:
bportlock:

Tried this - still get call to undefined function error for mysqli_connect.  One thing I tried which also didn't work was changing the extension_dir= setting in php.ini to a folder of my own creation.  I found out the path to my folder on the shared server from the error thrown by trying to use mysqli_connect.  I then installed mysqli.dll in this folder.

This didn't work.  Should it have done?

Thanks a lot.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.