[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Can I add PHP extensions on a shared server?

Posted on 2008-11-05
8
Medium Priority
?
934 Views
Last Modified: 2013-12-13
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
0
Comment
Question by:deafpanda
  • 3
  • 3
7 Comments
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 22884786
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
 
LVL 6

Expert Comment

by:hampus_b
ID: 22885334
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
 

Author Comment

by:deafpanda
ID: 22886139
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:deafpanda
ID: 22886808
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
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 22887553
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
 

Author Comment

by:deafpanda
ID: 22887831
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
 
LVL 34

Accepted Solution

by:
Beverley Portlock earned 2000 total points
ID: 22893385
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question