phpMyAdmin - The MySQL Extension is Missing - php

I installed everything separately (Apache, PHP, MySQL and phpMyAdmin) and do not use a compilation, everything works fine till now except phpMyAdmin.
The problem I am experiencing is, that the error message states that the "MySQL extension is missing", as soon as I try to call up:
localhost/phpmyadmin/index.php
And when I call up
localhost/phpmyadmin/setup/index.php
I have two messages where I do not know if it is supposed to be like that:
Bzip2 compression and decompression requires functions (bzopen,
bzcompress) which are unavailable on this system.
and:
Zip decompression requires functions (zip_open) which are unavailable
on this system.
Any suggestions?

At first make sure you have mysql installed properly. You can ensure it just by checking that whether you can access mysql using mysql command promp. So if you mysql is working then probably it is not loading. For that follow the steps given below
First of all, you must find your php.ini. It could be anywhere but if you create a small php file with the
<?php phpinfo(); ?>
script it will tell you where it is. Just look at the path of loaded configuration file.
Common places include /etc/apache/, /etc/php4/apache2/php.ini, /etc/php5/apache2/php.ini or even /usr/local/lib/php.ini for Windows it may be C:\Users\username\PHP\php.ini
Edit your server’s php.ini and look for the following line. Remove the ‘;’ from the start of the line and restart Apache. Things should work fine now!
;extension=mysql.so
should become
extension=mysql.so
For windows it will be
;extension=mysql.dll
should become
extension=mysql.dll

Some linux distributions have a php_mysql and php_mysqli package to install.

You need to put the full path in the php ini when loading the mysql dll, i.e :-
extension=c:/php54/ext/php_mbstring.dll
extension=c:/php54/ext/php_mysql.dll
Then you don't need to move them to the windows folder.

In my case I had to install the extension:
yum install php php-mysql httpd
and then restart apache:
service httpd restart
That solved the problem.

Just as others stated you need to remove the ';' from:
;extension=php_mysql.dll and
;extension=php_mysqli.dll
in your php.ini to enable mysql and mysqli extensions. But MOST IMPORTANT of all, you should set the extension_dir in your php.ini to point to your extensions directory. The default most of the time is "ext". You should change it to the absolute path to the extensions folder. i.e. if you have your xampp installed on drive C, then C:/xampp/php/ext is the absolute path to the ext folder, and It should work like a charm!

I just add
apt-get install php5-mysqlnd
This will ask to overwrite mysql.so from "php5-mysql".
This work for me.

Installing bzip2 and zip PHP extensions solved my issue in Ubuntu:
sudo apt-get install php7.0-bz2
sudo apt-get install php7.0-zip
Use php(you version)-(extension) to install and enable any missing modules that is required in the phpmyadmin readme.

Your installation is missing some php modules, there should be a list of required modules in the phpmyadmin readme. If you recently enabled the modules, try restarting the apache service / daemon.
Edit: As it seems, there is no single "enable these modules" in the docs, so enable either mysql or mysqli in your php.ini (you might need to install it first).
The two messages are not important if you do not intend to upload or download compressed file within phpMyAdmin. If you do, enable the zlib and / or bz2 modules.

I had a similar issue, but it didn't help to add extension=mysql.so in my php.ini. It turned out that the mysql.so file was not in my extension folder nor anywhere else on my machine. Solved this by downloading the php source and building the extension manually and then copying it into the extension folder.

Just check your php.ini file, In this file Semicolon(;) used for comment
if you see then remove semicolon ;.
;extension=mysql.dll
Now your extension is enable but you need to restart appache
extension=mysql.dll

Related

PDOException “could not find driver” with heroku, postgres and laravel [duplicate]

pdo is working fine with mysql but with pgsql its giving error 'PDOException' with message 'could not find driver' I've installed php5-pgsql package which also includes pdo_pgsql
http://packages.debian.org/sid/php5-pgsql
This package provides a module for PostgreSQL database connections directly from PHP scripts. It also includes the pdo_pgsql module for use with the PHP Data Object extension.
my dsn is pgsql:dbname=DB;host=192.168.0.2
I am using Ubuntu 10.04
This message means you need to install and or activate postgresql extension in PHP
This solution works for me :
To install postgresql extension
[sudo] apt-get install php-pgsql
after, for activating it, uncomment pgsql and pdo-pgsql extensions in etc/php/$PHP_VERSION/apache2/php.ini file
Finally, type :
[sudo] /etc/init.d/apache2 restart
To restart apache server if you use apache such as was my case...
1) Have you enabled pgsql.so in php.ini (extension=pgsql.so)?
2) Is you Postgresql listenin on 192.168.0.2 interface? (You can check it by netstat -tpln)
3) How you authenticate your access into Postgresql?
Make sure you've uncommented the line that tells php where the Postgres driver is (usually extension=pgsql.so) in the main php.ini file.
I had the same issue. First of all - check is it enabled in php.ini. Uncomment extension=php_pdo_pgsql...
than set up extension directory!!
extension_dir = "ext" ; for your case it could be other dir.
and do not forget to restart server after changing the config.
Try to remove semicolon in front of
extension=pgsql
extension=pgsql.so
included in your php.ini file
You can do that from the XAMPP Control Panel.
Here is what I did to solve the problem.
Edit php.ini and remove ; from extension=pdo_pgsql. Also, add extension=pgsql.so to the php.ini file.
Make sure to restart the Apache server before you try to see the result.
I had the same problem with another solution. I lost my around 4 hours to solve this problem. Please check the following to solve this problem.
Check php.ini file and remove semicolon from this line
extension=pgsql
extension=pdo_pgsql
Restart your apache2 server
sudo service apache2 restart
Check if your PDO driver has updated in localhost phpinfo()
I did All the things right and still I had this problem. And you know why? Because I had several versions of php installed. So I was running php7.4 in my php cli but localhost was running on php7.2. So always check your php versions.
Check your php version on localhost and terminal cli
When you do not have postgresql installed on the same machine that is Apache and PHP; you have to install php-pgsql and don't have to add extensions in php.ini manually in Linux (in Windows yes), because redundancies are generated and this does not work (checked in error.log).
$ sudo apt install php-pgsql
Then you can check the existence of the extension enabled automatically in:
$ sudo nano /etc/php/7.0/apache2/conf.d/10-pdo.ini
Observations: In phpinfo() you will find the directory conf.d/ and the file error.log
GL
Just run php --ini and look for Loaded Configuration File in output for the location of php.ini used by your CLI
then check you have enabled the extensions correctly.
Copy libpq.dll from the PHP directory to Apache24\bin (or wherever your installation could be).

symfony2 requirements cant be met

Was trying to play with symfony2. If I hit the web/config.php of my symfony2 installation it shows me the following problems
Install and enable the mbstring extension.
Install and enable the intl extension (used for validators).
Install and enable a PHP accelerator like APC (highly recommended).
Install PDO drivers (mandatory for Doctrine).
I can understand that these are not mandatory ones but question is I fixed these in my php.ini file but still cant see any reflection in this page. Here is how I fixed the above problems
extension=php_intl.dll
extension=php_mbstring.dll
extension=php_pdo_mysql.dll
Didnt install anything for APC so no complain with that. Restarted apache server "thousand" times, but no luck.
Side Note:
I tried to figure out something from phpinfo(). I can see one discrepancy. The phpinfo is showing one of my old php directory path F:\Softwares\Development\PHP\php-5.5.13-x64. This path used to exist in my system PATH variable earlier. But I myself remove this location from System PATH variable. But it is still visible in phpinfo(). But if I print the PATH variable from command prompt or cygwin console, it shows the correct PATH variable.
Also ran php app/check.php. It shows everything OK except the APC, which is completely fine for me. But it also shows that "PHP CLI can use a different php.ini file than the one used with your web server".
Environment Details:
OS: Windows 7
php: php-5.4.30-Win32-VC9-x86
Apache: Win32-2.4.9 VC9
MySQL: mysql-5.6.19-winx64
Not using any xampp/wampp etc.
Few more hear left on my head. Please help.
Make sure that you have these extensions in your ext directory, if not search and put it in the directory (for windows extension file type must be .dll).
APC https://www.dropbox.com/s/hmnrgle8xing3fo/php_apc.dll
INTL https://www.dropbox.com/s/wm14zk0grc6pm6v/php_intl.dll (you also need ICU lib)
mbstring https://www.dropbox.com/s/wm14zk0grc6pm6v/php_intl.dll
PDO mysql https://www.dropbox.com/s/hd5cm02oti8qw3s/php_pdo_mysql.dll
Also, don't forget to restart apache after changes in php.ini

mysqli extension is not present in php.ini file

I asked this question recently :
PHP is not working on server
I asked my hosting service provider to enable these extensions in php.ini by removing semi colon .
;extension=php_mysql.so
;extension=php_mysqli.so
;extension=php_pdo_mysql.so
They replied me that there is no option like this present in php.ini file.
Please tell me what I tell them to what to do? Because without this I can't connect to database and many more things.
Note : They are running in Linux.
Dear there can be 2 possible issues, if mysqli is not working on server.
1- php mysqli is not installed.
2- extension is disabled.
If you have putty excess you try this command to install it.
apt-get install php-mysqlnd
or
yum install php-mysqlnd
Otherwise enable the service from php.ini:
extension=mysql.so
extension=mysqli.so
extension=pdo_mysql.so
The extensions are most likely present as:
;extension=mysql.so
;extension=mysqli.so
;extension=pdo_mysql.so
Without the php_ prefix, and if they are not present they should just add it, provided that the extension library is really present on the system.
On some distributions the extensions are configured each in their own ini file. For example you will find the mysqli setting on debian in the file /etc/php5/mods-available/mysqli.ini and you can enable it using this command:
php5enmod mysqli
You can make your own php.ini file on the basis of need.
Make a file with your by writing all the extensions etc and save it as php.ini and put it in your folder where you are using this code.

PHP Fatal error when trying to access phpmyadmin mb_detect_encoding

Not sure what happened, but below is what the log is giving me when trying to access phpmyadmin, please help. Trying to debug a different problem and ran into this. Not really possible to revert back to when it was working.
PHP Fatal error: Call to undefined function mb_detect_encoding() in
/usr/share/php/gettext/gettext.inc on line 177
When trying to go the the site, I get this error, I think it's likely the two errors are related:
Database connection error (1): The MySQL adapter 'mysqli' is not available.
First error is caused by php because the extension mbstring is either not installed or not active.
The second error is output of phpMyAdmin/your site asking you to install / enable the mysqli extension.
To enable mbstring and mysqli edit your php.ini and add/uncomment the two lines with mbstring.so and mysqli.so on unix or mbstring.dll and mysqli.dll on windows
Unix /etc/(phpX/)php.ini
extension=mysqli.so
extension=mbstring.so
Windows PHP installation folder\etc\php.ini
extension=mysqli.dll
extension=mbstring.dll
Don't forget to restart your webserver after this.
EDIT:
User added he was using redhat in the comments so here's how you install extensions on all CentOS/Fedora/RedHat/Yum based linux distros
sudo yum install php-mysqli
sudo yum install php-mbstring
restart your werbserver
sudo /etc/init.d/httpd restart
you can verify your installation with a little php script in your document root.
This lists all settings, versions and active extensions you've installed for php
test.php
<?php
phpinfo();
After reading about the extension_dir = "ext" i added the line to php.ini but didnt work, then started to look apache error log and saw the PHP was in fact unable to find the dll's in the specified directory "ext". I commented the extension_dir line, restarted Apache and looked the error log again, saw that PHP was now looking the dll's in C:/PHP/ext (by default i guess), but since im using other folders, that's not the correct path, so i uncommented the extension_dir line and wrote this:
extension_dir = "C:/Apache24/PHP/ext"
In my configuration that is the correct path to dll's.
and of course, uncommented:
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
Restarted the Apache server and internet browser and now phpMyAdmin works with my mySQL login.
So, dll's incorrect path and dll's needed commented in php.ini were the problem.
Remember to restart Apache and internet browser after editing config files.
System spec:
Windows 7 HB 64bit
httpd-2.4.4-win32-ssl_0.9.8.zip
php-5.4.16-Win32-VC9-x86.zip
phpMyAdmin-4.0.4.1-all-languages.zip
mysql-installer-community-5.6.11.0.msi
Hope this help. Thx for your comments too.
in ubuntu 16.04 when i tried to connect to phpmyadmin a white blank paged appeared so i ran the above command and phpmyadmin works
sudo apt-get install php-mbstring php7.0-mbstring php-gettext
for mysql support install
sudo apt-get install php7.0-mysql
tested in ubuntu 16.04 with php 7 version
It looks like your PHP installation does not have the mbstring extension and the mysqli adapter extension installed.
Please check your phpinfo(); or run php -i | grep 'mbstring\|mysqli' in a terminal.
I had the same problem on my windows7- 32 bit:
1."PHP Fatal error: Call to undefined function mb_detect_encoding() in /usr/share/php/gettext/gettext.inc on line 177"
when i opened my php.ini file , "extension_dir" line looked like following :
extension_dir = "C:/wamp/bin/php/php5.4.16/ext/"
which i changed to :
extension_dir = "C:\wamp\bin\php\php5.4.16\ext\"
and it worked.
In php.ini, I had to change
extension_dir = "ext"
to
extension_dir = "C:/PHP/ext"
as my PHP was installed in C:\PHP. I had to use / instead of \, and then it worked.
Also uncomment mbstrings, mysqli and mysql extensions.
What helped me (using XAMPP on Windows) was to:
make sure that my path included the correct path for PHP (I had two PHP
installations, one under c:\php and the XAMPP installation in
c:\xampp\php which was the one I wanted to use)
check that the lines
extension_dir="C:\xampp\php\ext" extension=php_mbstring.dll extension=php_exif.dll ; Must be after mbstring as it depends on it were uncommented in the php.ini file (i.e. no ; at the beginning)
restart the Apache server
last but not least, clear the cache when reloading the page http://localhost/phpmyadmin/ (for instance with Ctrl-F5 in Chrome)
Recompile PHP with mbstring.
./configure --enable-http --with-apxs2 --with-mysql --with-gd
--with-curl --with-mbstring
make
make install
My guess would be to check that the mysqli extension is enabled in your PHP configuration. More info would be great (eg. OS, AMP stack, etc.).
Check in your php.ini configuration for mysqli and make sure there is no ';' in front of the extension. The one enabled on my setup is php_mysqli_libmysql.dll.
Try to install mysqli and pdo.
Put it in terminal:
./configure --with-mysql=/usr/bin/mysql_config \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd
I tried on Windows and I was getting same issue after enabling this in PHP installation folder\etc\php.ini:
extension=mysqli.dll
extension=mbstring.dl
You should also enable the following in the ini file:
extension_dir = "ext"
phpMyadmin is working now!
In windows 2008 Server.
i removed ";" in front of extension=php_mbstring.dll in php.ini file and it worked... i followed below link...
https://bugs.php.net/bug.php?id=64965
Some versions of windows do not come with libmysql.dll which is necessary to load the mysql and mysqli extensions. Check if it is available in C:/Windows/System32 (windows 7, 32 bits). If not, you can download it DLL-files.com and install it under C:/Windows/System32.
If this persists, check your apache log files and resort to a solution above which responds to the error logged by your server.
One options is:
disabled this extension_dir = "ext"
and the other is:
go to wamp icon and see php and the click on php error logs then from error log u can find exact error.
this error occurs only if paths are not properly set.
I had the same trouble, this is what worked for me.
You can click at the wampserver icon, then at the PHP error log.
Check if it says this:
Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_ldap.dll'
If yes, then you can reload your version of PHP, by clicking at the wampserver icon, then PHP, then version, and then you click at your version.
Wait for everything to be online again, then try to access phpmyadmin.

PostgreSql 'PDOException' with message 'could not find driver'

pdo is working fine with mysql but with pgsql its giving error 'PDOException' with message 'could not find driver' I've installed php5-pgsql package which also includes pdo_pgsql
http://packages.debian.org/sid/php5-pgsql
This package provides a module for PostgreSQL database connections directly from PHP scripts. It also includes the pdo_pgsql module for use with the PHP Data Object extension.
my dsn is pgsql:dbname=DB;host=192.168.0.2
I am using Ubuntu 10.04
This message means you need to install and or activate postgresql extension in PHP
This solution works for me :
To install postgresql extension
[sudo] apt-get install php-pgsql
after, for activating it, uncomment pgsql and pdo-pgsql extensions in etc/php/$PHP_VERSION/apache2/php.ini file
Finally, type :
[sudo] /etc/init.d/apache2 restart
To restart apache server if you use apache such as was my case...
1) Have you enabled pgsql.so in php.ini (extension=pgsql.so)?
2) Is you Postgresql listenin on 192.168.0.2 interface? (You can check it by netstat -tpln)
3) How you authenticate your access into Postgresql?
Make sure you've uncommented the line that tells php where the Postgres driver is (usually extension=pgsql.so) in the main php.ini file.
I had the same issue. First of all - check is it enabled in php.ini. Uncomment extension=php_pdo_pgsql...
than set up extension directory!!
extension_dir = "ext" ; for your case it could be other dir.
and do not forget to restart server after changing the config.
Try to remove semicolon in front of
extension=pgsql
extension=pgsql.so
included in your php.ini file
You can do that from the XAMPP Control Panel.
Here is what I did to solve the problem.
Edit php.ini and remove ; from extension=pdo_pgsql. Also, add extension=pgsql.so to the php.ini file.
Make sure to restart the Apache server before you try to see the result.
I had the same problem with another solution. I lost my around 4 hours to solve this problem. Please check the following to solve this problem.
Check php.ini file and remove semicolon from this line
extension=pgsql
extension=pdo_pgsql
Restart your apache2 server
sudo service apache2 restart
Check if your PDO driver has updated in localhost phpinfo()
I did All the things right and still I had this problem. And you know why? Because I had several versions of php installed. So I was running php7.4 in my php cli but localhost was running on php7.2. So always check your php versions.
Check your php version on localhost and terminal cli
When you do not have postgresql installed on the same machine that is Apache and PHP; you have to install php-pgsql and don't have to add extensions in php.ini manually in Linux (in Windows yes), because redundancies are generated and this does not work (checked in error.log).
$ sudo apt install php-pgsql
Then you can check the existence of the extension enabled automatically in:
$ sudo nano /etc/php/7.0/apache2/conf.d/10-pdo.ini
Observations: In phpinfo() you will find the directory conf.d/ and the file error.log
GL
Just run php --ini and look for Loaded Configuration File in output for the location of php.ini used by your CLI
then check you have enabled the extensions correctly.
Copy libpq.dll from the PHP directory to Apache24\bin (or wherever your installation could be).

Categories