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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

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
Beverley PortlockCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.