wamp cannot load mysqli extension - php

WAMP installed fine, no problems, BUT...
When going to phpMyAdmin, I get the error from phpMyAdmin as follows:
Cannot load mysqli extension. Please check your PHP configuration
Also, phpMyAdmin documentation explains this error message as follows:
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.
Finally, the apache_error.log file has the following PHP warnings (see the mySQL warning):
PHP Warning: Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
PHP Warning: Zend Platform does not support this version of PHP - please upgrade to the latest version of Zend Platform in Unknown on line 0
PHP Warning: Zend Debug Server does not support this version of PHP - please upgrade to the latest version of Zend Debug Server in Unknown on line 0
PHP Warning: gd wrapper does not support this version of PHP - please upgrade to the latest version of gd wrapper in Unknown on line 0
PHP Warning: java wrapper does not support this version of PHP - please upgrade to the latest version of java wrapper in Unknown on line 0
PHP Warning: mysql wrapper does not support this version of PHP - please upgrade to the latest version of mysql wrapper in Unknown on line 0
So, for some reason PHP is not recognizing the mysql extension.
Anyone know why? Any solution or workaround?

I deleted the PHP in program files ad everything started working , the problem that there two installations of pHp

I tried many solutions, and none worked for me. I tried the following solutions:
Restart wampserver
Reinstall wampserver
restart machine
and all other solutions mentioned in this question.
However, none of these worked. Then I found that my PHPMyAdmin was not working in chrome and was working in firefox. So I tried clearing cache, restarting browser etc, but still it would not work.
Then I deleted all the files from C:\wamp\tmp and then tried again, and it works. I am not sure why it works, but here is what I think. The session was cached and not getting cleared. So as soon as I deleted all files in this directory all the sessions were deleted and hence it worked fine.

First, make sure that the php.ini file is loading the mysqli extension.
If you are using WAMPServer, click on the icon in the system tray, go to PHP -> PHP Extensions and make sure it is checked. If not, go into the php.ini file and make sure that the line: extension=php_mysqli.dll is uncommented (eg, remove the ; if it exists). If that line does not exist, add it.
If this still does not work, double check that the right php.ini file is being loaded.
To do so, view your phpinfo() (Here for WAMPServer). Scroll down to the Loaded Configuration File row and see which php.ini is being loaded.Make sure it is the right file. If you're using WAMPServer, it should be(WAMP INSTALL FOLDER)\bin\apache\Apache2.2.11\bin\php.ini. By default, it isC:\wamp\bin\apache\Apache2.2.11\bin\php.ini`.
If a different php.ini file is being loaded, just rename it to something else so that PHP will try and find the file somewhere else. There should be a way to specify which on eyou want to use, but I forget exactly how to do that...
If this still doesn't work... Try messing around with phpMyAdmin's settings, or using another answer, but I'm afraid I can't help beyond this.

I was running WAMP with two PHP versions 1) 5.2.9 and 2) 5.2.13.
As per site requirement i needed to change PHP version to 5.2.9 from 5.2.13. after swapping PHP version, error was "mysqli extension is missing". after debugging long time i get to know it was due to wrong "extension_dir" path in php.ini file.
So i changed its value:
Old: "extension_dir" c:/wamp/bin/php/php5.2.13/ext/
New: "extension_dir" c:/wamp/bin/php/php5.2.9/ext/
Restarted All services in wamp server, then it's fixed.

I had the same problem. I had WAMP server installed. All was working fine. Then one day I restarted my computer and it just stopped working! I tried desperately going through all help posts and doing them but nothing worked.
What they usually suggest you do is, first go to your php.ini file and make sure your 'extension_dir' is properly set. Then to make sure these two lines are not commented (remove the ; infront):
extension=php_mysql.dll
extension=php_mysqli.dll
Then some suggested that I download fresh copies of these two files but none worked. I also tried uninstalling everything (php/mysql/apache) and reinstalled fresh copies of WAMP server several times but with no luck.
Finally I managed to find an alternative solution. I switched to 'easyphp' (http://www.easyphp.org/). This is something very similar to WAMP. First I made backups of my sql databases so I can reload them on the new installation.
Then I installed 'easyphp' and everything seems to work fine. I reloaded my sql databases from my backup and now things are back to normal.
I hope someone suffering from a similar prob. will find this useful. If someone has really found a fix to make WAMP server work. Pls do be kind enough to post it here so many will benefit.

in wampserver go to php.ini. open the file and uncomment extension=msql.dll by removing semicolon(;) for respective operating sytem.

Just add in your php.ini:
[PHP_MCRYPT]
extension=php_mcrypt.dll
[PHP_MYSQL]
extension=php_mysql.dll
[PHP_MYSQLI]
extension=php_mysqli.dll

Also setup the mysql password:
SET PASSWORD FOR root#localhost=PASSWORD('your_password');
And the phpmyadmin mysql password in config.inc.php:
$cfg['Servers'][$i]['password'] = 'your_password';

Had the same problem, with wamp. Try to exchange your current version of php.ini with a backup. There is one in: wamp\bin\php\php5.3.0phpForApache.txt. Worked for me.

Just wanted to chime in on this one. Using Wamp Server 2.0, and using Zend Studio with Zend debugger for development.
I wasn't able as of yet (will get back to it at some point) to get the zend debugger working with php 5.3. So in wamp I loaded an earlier php version, 5.2.11. I was getting the same error when acessing php my admin.
What I had to do was change the php.ini file value for "extension_dir" to c:/wamp/bin/php/php5.2.11/ext/ to match the version of php I was using. After that it was all good.

I had this problem and spent 2 hours trying all the solutions online, none worked.
Tried this, and it woked:
Change
mysql.default_host =
to
mysql.default_host = localhost
and restart WAMP. pay attention if you are using mysqli or not.

I had the same error. When I increased the script memory size and enabled E_ALL then restarted the server, I got that error in phpmyadmin. All I had to do to fix it was restart my computer!

I got this problem for a long time. Tried all I've read on forums and this finally worked for me:
Open your php.ini (I assume you've got the good one that is loaded...) and find this line
mysqli.default_port = 3306
change for
mysqli.default_port = 80
Restart all services
Go to localhost/phpmyadmin -> won't work
Reopen the php.ini file and retype this
mysqli.default_port = 3306
Restart all services
Worked for me.

For me worked this, after searching all logs/internet/every non-normal things.
You have to register dl by:
Through application:
WAMP -> PHP settings -> enable dl
or
# php.ini #
; Whether or not to enable the dl() function. The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
; http://php.net/enable-dl
enable_dl = On

I have just installed WampServer, and faced same problem. I have found solution, that works for me, it is ridiculously simple.
Disable PHP extension php_mysqli.
Restart WampServer, visit local phpmyadmin.
Enable php_mysqli back.
Repeat step 2.
After few page refreshes, remaining errors plates (about MySQL and sqli) had gone.

i tried hard by
installing the wamp again and again,
by checking the php.ini file,
by restarting the machine,
by replacing the index.php file,
but none works.
then i go to the wamp/temp and deleted all files and it works fine now.

I had path variable in windows set to some random version of php.
The fix was to update it and set it to the folder within my wampserver installation:
C:\wamp64\bin\php\php5.6.38
Then I realized this is wrong also for my specific case, and I should actually be running the script from within vagrant. Live and learn.

I had this issue because of a different reason:
Check the PHP Error Log(Get from the Wamp Tray -> PHP -> PHP Error Log.
I had a syntax error in the php.ini file while I was editing the file.
Check the log and clear the error. This will open your PhpMyAdmin properly.

Check your phpForApache.ini file's extensions. This file should be same as your php.ini file.

Related

I'm trying to enable sqlsrv in PHP on my local machine, but it's not showing in php.ini

I'm trying to enable sqlsrv in php, i've installed/downloaded the php_sqlsrv_74_ts_x64.ddl and added it to the extensions in php.ini, resarted iis. When I open phpinfo it doesn't show.
I cannot figure out what's wrong with it.
I'm trying to connect to a MS SQL server.
PHP Version = 7.4.6.
Any help is appreciated.
You should be able to view the real error message when you double click C:\...\PHP\v7.4\PHP_CGI.exe like
So please check whether your extension_dir are pointing to the right place.
extension_dir = "C:\Program Files\PHP\v7.4\ext"
And you have put php_sqlsrv_74_ts_x64.dll in the ext file.
This is how I register the extension. The driver file must match the PHP version, architecture, and threadedness of your PHP environment.
extension=sqlsrv_74_nts_x64
You can modify the configurations untill php-cgi.exe no longer report any exception.
Finally the most important thing is run "IISRESET" in CMD adminsitrator mode.
Then you will see these extension in phpinfo.
Please ensure your IIS is mapping to the correct php_cgi.

WP database error Unknown column ‘wp_’ in ‘field list’ for query SELECT wp_

Please do not close this question, it's not a duplicate and the suggested link explaining how to use quotes on MySQL does nothing for me since this problem is inside a WP script. Thanks
I’m trying to install WP 5.4.1 on a clean Windows 2019 Server virtual machine.
I didn’t use Microsoft Web Platform Installer since it download old versions of WP / MySQL and PHP, so I’m trying to install from scratch.
Here are the steps I’ve taken:
Downloaded and Installed latest PHP 7.4.5, non thread safe version
and installed it
renamed php.ini-production to php.ini
Edited php.ini to:
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
extesion=mysqli (removed the semicolon here since PHP needs this driver to connect to MySQL8)
In IIS I created the *.php mapping and added default.php and index.php
Created the dummy phpinfo.php file and tested on IIS, all working correctly and phpinfo() shows data
Downloaded MySQL 8.0.20 and installed with the following options:
Server only
Standalone
Server computer
For the authentication method I choose ‘Use Stron password encryption’ as suggested by the PHP installer
added MySQL BIN folder to path environment variable
opened %PROGRAMDATA%\MySQL\MySQL Server 8.0\my.ini and disabled sha2 and enable native_password:
;default_authentication_plugin=caching_sha2_password
default_authentication_plugin=mysql_native_password
created a new database for WP, called wp1 (in MySQL 8, the ‘one liner’ to create the user and grant access at the same time doesn’t work, so we need to do it in 2 lines)
mysql -u root -p
create database wp1;
CREATE USER ‘wp1’#’%’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON wp1.* TO ‘wp1’#’%’;
FLUSH PRIVILEGES;
EXIT
created the folder C:\intepub\wwroot\wp1 and give full access to IUSR and Users windows groups so WP can write the config files
In IIS, right click on the Default Web Site and click on Add Application pointing to the new wp1 folder
navigate to localhost/wp1 to start WP installation
So after selecting the language and entering the DB info, I get this error
WordPress database error Unknown column ‘wp_’ in ‘field list’ for query SELECT wp_
After hours fighting with this, here’s what I found:
the error came from the DB, not WP.
tried with both wp1 and root users during the installation
tried with both localhost and 127.0.0.1 during the installation
the error generates in setup-config.php file, line 315 $wpdb->query("SELECT $prefix")
seems the problem is that what arrives at MySQL is the string select wp_ insted of select 'wp_' (note the missing quotes)
If I go to MySQL and execute select wp_ I get the exact same error
So the issue seems to be related to how MySQL 8.0 is handling quotes in the query it receives from WP installer…
I restored a snapshot just before installing MySQL 8.0.20 and this time, instead of
Use Strong Password Encryption for Authentication
I selected
Use Legacy Authentication Method (Retain MySQL 5.x Compatibility) but the error is still the same
Before answering, please consider:
I’m looking to solve the issue, not to start a discussion whatever I should use MySQL 5.x instead of MySQL 8.x
Yes, the connection to the database is Ok, that’s not the problem, please read all the my post
Yes, wp-config is being written with the correct values
Even tough I saw many messages with this same error on the WP forum, they normally have no answer, or the answer don’t make any sense (like asking to OP to check the DB credentials and write access to the WP folder), still I posted on the WP forum, but I no answer yet.
Sorry for my poor formatting!
Can anyone please help?
Finally found the issue...
TLDR; edit your php.ini and make sure you have both:
display_errors = On
error_log = php_errors.log
Setting error_log solves the issue... I guess that when error_log has no value (default configuration), PHP decides to send the error back to the calling program, resulting in the error message column 'wp_' in 'field list' during the WP installation.
More details here
I just deleted lines 317 to 322 in wp-admin\setup-config.php re-ran the setup and it all worked fine.
Might not be the right solution but the only thing that worked for me.
This was for WP 5.5.3, previous versions I had no issues downloading and installing
This error is possible if WordPress version doesn't support server's PHP version.
In my case I recently installed the latest XAMPP with PHP 8.1.1 and had to downgrade PHP to 8.0.14 in order for WordPress 5.8.2/5.8.3 to be installed and work properly.
I just deleted lines 317 to 322 in wp-admin\setup-config.php re-ran the setup and it all worked fine.
Might not be the right solution but the only thing that worked for me.
This was for WP 5.5.3, previous versions I had no issues downloading and installing
Same for me on version 5.6.2 when trying to install a second site using the same database so needed new table prefix
None of the above solutions is worked for my case. Because I have already installed Mysql workbench on my windows machine. I stopped the already running mysql server, I have followed the below mentioned steps.
Open command prompt, then navigate to the following path
C:\Program Files\MySQL\MySQL Server 8.0\
Then ran the following command
mysqladmin -u root -p shutdown
After that I restarted the apache and mysql on xampp server it is working fine.
I found a solution, for me the problem was in php folder (exactly "php.ini" file), so to get the standard settings I just installed windows server 2019 in VMWare then installed "php 7.4" using web platform, then I copied the PHP folder from VMWare "C:\Program Files (x86)\PHP\v7.4" to my PC (windows10), then I download "wordpress5.8.2", and "mysql8.0.1", after installing mysql and creating DB for wordpress(just create DB) and setup the IIS in my windows10, I ran localhost and every thing working good and wordpress installed without any errors.
So try to get the php.ini that installed with web platform and overwrite it on your php folder and run, if it does not work try to copy the whole php folder and try again, I tried this with php 8.0 but have many errors.

blackfire config issue with php probe

So I'm trying to install "Blackfire" from Sensiolab and following all the instructions et.. I'm facing an issue when lauching it to profile my app and also for any related php cli that I'm running...:
The error message is:
“Unable to load dynamic library ‘/usr/lib/php/extensions/no-debug-non-zts-20160303/blackfire.so’” => faire enough, there is no blackfire.so in that directory...
The I checked my blackfire.ini and the config seems fien referencing the path where blackfire.so is actually stored:
[blackfire]
extension="/usr/local/Cellar/blackfire-php71-zts/1.23.1/blackfire.so"
I also tried to add some config to php.ini and when I run phpinfo() nothing has been updated...:
[blackfire]
extension=blackfire.so
; On Windows use the following configuration:
; extension=php_blackfire.dll
; Sets the socket where the agent is listening.
; Possible value can be a unix socket or a TCP address.
; Defaults to unix:///var/run/blackfire/agent.sock on Linux,
; unix:///usr/local/var/run/blackfire-agent.sock ;on MacOSX,
; and to tcp://127.0.0.1:8307 on Windows.
;blackfire.agent_socket = unix:///var/run/blackfire/agent.sock
blackfire.agent_timeout = 0.25
Thanks in advance for your help guys
Well actually I resolved the issue by:
Getting rid of MAMP stack as the php version installed with Homebrew was conflicting with the MAMP version and I honesty couldn't figure out which php.ini was used eventually even using the related command... it was showing the homerew one but I had the feeling that this was causing me issues...
I uninstalled balckfire and installed it again (no more MAMP) and of course PHP with Homebrew and it worked fine... just a little set up issue that I had fixed doing the below
changing the default setting in the blackfire.ini
this was defaulted socket=tcp://127.0.0.1:8307 while I have a unix/OSx and the following should have been defaulted instead unix:///usr/local/var/run/blackfire-agent.sock
Hope this will help someone in the same situation

How to enable oci in xampp 5.6.3?

I am facing some issue while starting Apache server via XAMPP. I have installed XAMPP Version 5.6.3.
When I start the Apache server from xampp control panel, an error message is displayed as shown below:
On clicking 'OK' button, another dialog box is displayed as shown:
The thing is I wanted to use OCI instead of mysql. so I have commented out the mysql extensions and uncommented the OCI extension in php.ini file.
The php_oci8_12c.dll file is the only file available in the extensions (ext) folder of php in xampp. Hence I included the line in the php.ini as shown in the above image.
Since then I am getting this error.
I have installed instant client 12.1 as well but no luck. I also tried copying the OCI.dll from instantclient_12_1 and pasting it in c:/xampp/php and c:/xampp/apache/bin. The error still persists.
Need help..
UPDATE: I removed other oracle paths in PATH of environment variables, keeping only the instantclient path. Now I am getting this error..
Well, I've installed XAMPP 1.8.2, PHP 5.4 and Apache 2.0, and I use php_oci8_11g.dll and works fine.
You are trying use php_oci8_12g.dll, I recommend you read this link http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-12c-2088811.html with especifications for run oci12g.
I solved the issue after stuck 2-3 days .
Before follow steps Some things to remmember .
1- I am using win 8.1 64 bit .
2- Using Xampp 5.6.31 32 bit .
3- Using instaclient 12.2.0.1 64 bit (Because my win 8.1 is 64 Bit ) .
Now steps are below -
Step 1 - Download xampp 5.6.31 32 bit and install it .
Step 2 - Download and install oracle 11g R2
Step 3 - Download and install OTN (oracle instaclient 12.2.0.1 )
Extract all files in any drive in my case i have extract in C:\oracle\instaclient12.2.0.1
Add (C:\oracle\instaclient12.2.0.1 ) it to the path variables of the system. and also add new variable under variable of system with name TNS_ADMIN and put same path (C:\oracle\instaclient12.2.0.1 ) in its value .
Its time to set PHP.INI here uncomment following (see image below)
PHP.ini setup
Copy 3 files from C:\oracle\instaclient12.2.0.1 oci.dll,oraociei12.dll and oraons.dll to xampp apache\bin . by this step Unable to load dynamic library issue has been resolved .
Unable to load dynamic library issue solution
Now restart Apache on xampp and check info.php on browser . OCI8 module will appear there enable .
Enjoy !!!.
I solved the issue. The problem was that I was trying to use a 64 bit DLL(php_oci8_12g.dll) in a 32 bit PHP. I downloaded a 32 bit instantClient and it works now! :-)
instantclient-basic-nt-12.1.0.2.0.zip
I had a problem related to OCI8 and XAMPP for days in a row, the problem was shown as:
Fatal error: Call to undefined function oci_connect()
I was able to correct it using the php that comes by default with XAMPP. I'm using windows 10 64 bits as well, but used xampp-win32-7.3.2-0-VC15 (php 7.3.2). To summarize, I was able to get a correct configuration by doing everything with 32 bits versions (except the o.s). The full story and how I've done it:
If you go to your xampp/php directory through cmd, in my case it was "C:\xampp\php", and start the php by the simple command "php" it will probably show what dlls are not being found in the etc folder or which of those are not Win 32 compatible. If you get this problem, you will not be able to see the OCI8 page when opening a phpinfo() page:
If that's the case, with win 32 compatibility problems or not finding the dlls that you are certain are there, you should unistall XAMPP and reinstall it using a x32 version. The phpinfo page will show x86 Architecture. Remember to remove in the path variables any source that miss locate your php in use, the point here is to use the one given by default in XAMPP. If you need by any reason to use another php installation, remember to use x86 architecture.
If you need an updated OCI8 dll you can download it on https://pecl.php.net/package/oci8 , but remember to check the Thread Safety compatibility, you can find it on your phpinfo page as well. In my case it was enough to use the one provided by XAMPP.
After this, you have to enable the extension:
extension=oci8_12c
in the php.ini configuration file. It was enough for me to enable only this one, although some people suggests to also enable extension=pdo_oci. My suggestion is to try this only if you failed to install with the path here shown. It's also good to check if you are set in the correct path regarding the extensions, in my case:
extension_dir="C:\xampp\php\ext"
After this, you have to download the Oracle Instant Client. Since you are using x86 architecture (you must use this one), you need to find a 32-bit version of the OIC, but is also important to check which one is compatible with the extension you uncommented. In my case, of oci8_12c, it was instantclient-basic-nt-12.2.
The final step is to unzip it to a folder, like "C:\instantclient_12_2" and add it to the path variables of the system.
Reload apache and check if the OCI8 is shown correcly.

php & mysql: configuration with a twist

I have a bit of an interesting problem concerning the configuration of php and mysql. I cannot configure them to work together. Whenever try to connect to a mysql database, I get the following error: Fatal error: Call to undefined function mysql connect( ) .
I am currently using the latest version of mysql and php and am using a Windows 7 box as the server.
Due to certain restrictions, I cannot use a prefigured web server or package (no xampp, apache or easyphp). Therefore, I am pretty much restricted to using the built-in development server that comes with php. So far, I have done the editing to the php.ini file, removed the semicolon from php_mysql.dll to remove the ; and changed extension_dir = "C:\PHP\ext" to reflect my extension folder.
I guess the two questions I have are:
A) can the php 5.4 included development server even connect to a mysql database
B) if so, can anyone provide me with some possible fixes to this configuration problem?
Any help given is appreciated.
-
Try running phpinfo(); and see if you have configured it to work with MySQL.
You should enable php_mysql module from php.ini. Default is disabled.
From php.ini:
...
;extension=php_ldap.dll
extension=php_mysql.dll
extension=php_mysqli.dll
...
Remove ; from the corresponding module, save and restart apache.

Categories