Jump to content

Cannot load mysqli extension on live server


son

Recommended Posts

Having installed phpMyAdmin on live server I came across a problem. It says 'Cannot load mysqli extension. Please check your PHP configuration.' THis website relies on the mysqli extension, so I checked the documentation and found: "To connect to a MySQL server, PHP needs a set of MySQL functions called "MySQL extension". This extension may be part of the PHP distribution (compiled-in), otherwise it needs to be loaded dynamically. Its name is probably mysql.so or php_mysql.dll. phpMyAdmin tried to load the extension but failed. Usually, the problem is solved by installing a software package called "PHP-MySQL" or something similar." Guess the same applies to mysqli, just that the files are called mysqli.so etcAs I had a similar problem with a different website I thought the solution was the same. In the other case I just added 'SetEnv DEFAULT_PHP_VERSION 5' to the .htaccess file. This did not solve the issue. Then as my next step I created an 'ext' folder inside a 'php' folder (in web root) and uploaded the file from my local machine (on my local machine this is how it is set up)in there. Without any luck. Did I miss a step?How would I do this on a live server? It would be great if someone know how to do that? Any help more than appreciated. Son

Link to comment
Share on other sites

If by "live" server you mean you're on a host, you'll have to contact the host, and ask them to enable the MySQLi extension. It is very likely they don't allow dynamic loading of extensions for security reasons.

Link to comment
Share on other sites

If by "live" server you mean you're on a host, you'll have to contact the host, and ask them to enable the MySQLi extension. It is very likely they don't allow dynamic loading of extensions for security reasons.
Yes, you are right. I meant I am on a host.Running the check_info.php script in phpMyAdmin directory I found:mysqliMysqlI Support enabled Client API library version 5.0.32 Client API header version 5.0.32 MYSQLI_SOCKET /var/run/mysqld/mysqld.sock So, MySQLI seems to be enabled. Although it is strange that phpMyAdmin displays the error message I tried to upload a page, which uses mysqli and get:"Fatal error: Call to undefined function: mysqli_connect()"which refers to lineif ($dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD)) { // establish connnection.As this was working fine on the test server it looks like there is still a problem with mysqli, doesn't it? I always use this way of connecting to the db and it usually works fine. Technical support says it is enabled, but then he did not seem very confident about it...Actually, the info script give more info:Directive Local Value Master Value mysqli.default_host no value no value mysqli.default_port 3306 3306 mysqli.default_pw no value no value mysqli.default_socket no value no value mysqli.default_user no value no value mysqli.max_links Unlimited Unlimited mysqli.reconnect On On Son
Link to comment
Share on other sites

Also of interest: When I compare the phpinfo for mysqli the only difference to the domain where it was working is that this domain has:5.0.22 as version at top instead of 5.0.32 MYSQLI_SOCKET has a different pathand mysqli.reconnect is Off (on live domain it is Off)Can not see why it would not work...Son

Link to comment
Share on other sites

Now interestingly the hosting company claims all is fine as the check_info.php script in phpMyAdmin directory show the relevant mysqli info and php 5 being enabled, but when I upload a phpinfo.php into the root level of web space only mysql shows. I would think that this is the important bit, but hosting claims it is not and it must be a fault with my scripts (which run fine on other domain where website was built). Does this make any sense? It would be good if someone could let me know if I am correct in assuming that the phpinfo script in the root of web space is the relevant information, showing it is not enabled?Son

Link to comment
Share on other sites

Now interestingly the hosting company claims all is fine as the check_info.php script in phpMyAdmin directory show the relevant mysqli info and php 5 being enabled, but when I upload a phpinfo.php into the root level of web space only mysql shows. I would think that this is the important bit, but hosting claims it is not and it must be a fault with my scripts (which run fine on other domain where website was built). Does this make any sense? It would be good if someone could let me know if I am correct in assuming that the phpinfo script in the root of web space is the relevant information, showing it is not enabled?Son
Me, again... I found the scriptprint_r(get_loaded_extensions());and have to say that it looks like my hosting is right in that mysqli is enabled as it shows in array of loaded extensions. Still. I do not get why the phpinfo() did not show the mysqli info. And I still do not understand why I get fatal errors in webpages when it was perfectly working on other domain...->take it all back what I said in this post. run phpinfo() again and now it shows the mysqli bit. Guess that is why the get_loaded_extensions showed mysqli. As it looks the hosting company says one thing, but then does another. They are working on the case (there are other files appearing now when I ftp to domain)... Also, I just post all my steps as I received feedback that other user have same problem. Maybe it helps us all:-)Son
Link to comment
Share on other sites

Is their database server on the same machine as their web server? Do they actually have a DB server (some hosts may offer you the ability to connect to another computer's DB server without offering their own DB server)?You should again ask your host for assistance, ideally, ask for a sample code that would connect to the DB, and work your way from there.

Link to comment
Share on other sites

Is their database server on the same machine as their web server? Do they actually have a DB server (some hosts may offer you the ability to connect to another computer's DB server without offering their own DB server)?You should again ask your host for assistance, ideally, ask for a sample code that would connect to the DB, and work your way from there.
It started working some hours ago and I finally found what they have done now to make it work. I had in .htaccess the following entry: SetEnv DEFAULT_PHP_VERSION 5. This was not correct. They deleted the entry and added: AddHandler x-mapp-php5 .php. I cannot really find a good explanation on the web what this actually does. I thought my entry was ok. Does this mean that you can call .php5 files .php? Son
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...