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).
I am trying to use pgsql extension on Windows 10 64-bit (WAPP).
I have:
restarted Apache
uncommented all postgresql extensions in php.ini
used LoadFile to load pgsql.dll
moved pgsql.dll to Apache bin (I tried both dll from php folder and from postgresql)
But still no result.
pgsql is visible only in php.exe -m but not in phpinfo(), extension_loaded(), get_loaded_extensions().
My php version is 7.1.8 and PostgreSQL is 9.6 and Apache is 2.4.27.
My php.exe -m output:
What can be the problem?
[SOLVED]
Okay, after a few hours of looking, I found the problem and was able to solve the problem with the pdo_pgsql and pgsql modules not showing in phpinfo().
[SOLUTION]
After uncommenting the extensions in php.ini, go into httpd.conf and add at the top of all the LoadModule lines the following:
LoadFile "C:/Program Files/PostgreSQL/9.6/bin/libpq.dll"
(assuming you are using the latest version of PostgreSQL, otherwise change the number to the version you are using).
Save and restart Apache. Go to phpinfo() and you will see it is loaded.
[REASON]
Apache is unable to see the libpg.dll even if you copy it into the Apache/bin folder.
[ENVIRONMENT]
Windows Server 2016 (works for Windows 10 as well)
Apache 2.4.26
(x64) PHP 7.1.8 (x64 ThreadSafe VC14)
PostgreSQL 9.6.4 (x64)
Usually, command line PHP does not share the configuration file with Apache or in other words, the Apache php.ini is a different one then the one you edited.
Use phpinfo() running through apache and search for php.ini to locate the configuration file that was loaded.
The accepted solution also works for the latest version of PHP 7, namely 7.3.5 on Windows 10 environment.
The inclusion of the LoadFile directive atop all the LoadModule directives simply works fine. I too was struggling for the solution. It appears that there is some issue on the said environment that the libpq.dll doesn't get loaded by default. The solution is awesome.
Whenever I try to enter my phpMyAdmin, it gives me this error:
The mbstring extension is missing. Please check your PHP configuration.
I've looked all over the Internet for a fix, but all I've found is errors similar to mine, but not the same, or the exact same but there was no fix given.
I am also using Windows.
In Centos I have installed a php extension.
I did this with:
yum install php-mbstring
Before sometime I also had the same problem. I have tried replacing the .dll file but no result. After some debugging I found the solution.
I had this in my php.ini file:
extension_dir = "ext"
And I'm getting mbstring extension missing error. So I tried putting the full path for the extension directory and it works for me. like:
extension_dir = "C:\php\ext"
Hope this will help.
Cheers,
check your php.ini file in the root directory of your php installation. In the extensions part of the configuration you should find:
;extension=php_mbstring.dll
remove the leading ';' to uncomment and enable the extension so it looks like this:
extension=php_mbstring.dll
restart your apache and it should work.
Edit: I just read that you are already using a webhost. Does your webhost have a interface where you can set php variables etc? Or a .ini file you can edit?
If not you may are forced to talk to the webhost and ask them to enable that particular extension.
My case was like this
Strangely, I noticed that the php.ini file that WAMP was using wasn't
the one in the php directory, but rather was referencing a php.ini
file in the bin directory... I copied my php.ini file to
wamp\bin\apache\apache2.4.17\bin directory, restarted the wamp
services and PHPMyadmin was off and running...
Thanks I solved the problem
In Ubuntu Server I have installed a php extension.
I did this with:
sudo apt-get install php-mbstring
Another reason for this problem is Php version. When I changed the running PHP version to 7.0.0, problem has gone.
Ubuntu 15.10
1) sudo nano /etc/php/7.0/apache2/php.ini
uncommited extension=php_mbstring.dll
2) sudo apt-get install php7.0-mbstring
3) restart apache2
install mbstring and restart your apache:
sudo apt-get install php-mbstring
sudo service apache restart
then remove ; from your php.ini file:
;extension=php_mbstring.dll
to
extension=php_mbstring.dll
If it still doesn't work..remove your php setup, without removing the databases from your phpmyadmin. Reinstall it.
NB: * if you want to remove all, all mention the one you need to.
sudo apt-get remove php*
Then install the php and modules of the php version that you need. here, php 7.1:
sudo apt-get install php7.1 php7.1-cli php7.1-common libapache2-mod-php7.1 php7.1-mysql php7.1-fpm php7.1-curl php7.1-gd php7.1-bz2 php7.1-mcrypt php7.1-json php7.1-tidy php7.1-mbstring php-redis php-memcached
restart your apache and check the php version.
sudo service apache restart
php -v
when all this is done, execute the following command to enable mbstring forcefully and restart your apache.
sudo phpenmod mbstring
sudo service apache restart
Hope it helps.
It did to me :)
I've solved my problem by this way:
Edit the php.ini file:
change extension_dir = "ext" into extension_dir = "D:\php\ext" (please write ur own full path for the extension directory)
change ;extension=php_mbstring.dll into extension=php_mbstring.dll (delete the ";")
Then just save your php.ini file and copy it to ur Windows directory。(“C:\Windows“)
restart the apache server。
The above is my solution,Hope it will work for u.
Using xampp, this will work (php7 has been extracted to the xampp\php directory):
Make the following changes in the php.ini:
uncommend (remove the ;)
;extension=php_mbstring.dll
uncommend (remove the ;)
;extension=php_mysqli.dll
set the path to the extention Directory
extension_dir = "ext"
to the full path, for example:
extension_dir = "C:\xammp\php\ext"
Additional, change the xampp-settings in the httpd-xampp.conf:
change
LoadFile "C:/xampp/php/php5ts.dll"
to
LoadFile "C:/xampp/php/php7ts.dll"
change
LoadModule php5_module "C:/xampp/php/php5apache2_4.dll"
to
LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"
change all appearance (3 times) of
IfModule php5_module
to
IfModule php7_module
That's it.
I had this problem in the past with MAMP on a Windows machine.
Open MAMP start page and go to your current configuration of PHP (phpinfo).
Check the Configuration File (php.ini) PATH.
Mine was set to C:\Windows, where of course I had no PHP.ini file.
Either change the php.ini path to C:\MAMP\conf\php5.6.8 (or your php version conf path) or just copy php.ini to c:\windows.
after installing WAMP 3 with Apache 2.4.17 and php5.6.17 I tried to look at php.ini from wampserver (green icon in tray).
It wasn't finding it.
I copied php.ini from the php.5.6.15 directory to the apache2.4.17\bin\ directory
and phpmyadmin worked fine without missing mbstring
Solved it.
I tried all of the solutions above but it still did not work. I'm currently using WAMP to launch the mysql server. When I tried to open the "php.ini" file with the WAMP panel, it said that it did not exist and asked me to create a new "php.ini" in the location, "C:\wamp\bin\apache\apache2.4.17\bin". Once I created this new "php.ini" file, I located the existing "php.ini" file which was in the path "C:\wamp\bin\php\php5.6.15", and cloned it. I then pasted the clone in the previous path where it had asked me to create the "php.ini" file.
Hope this helped.
I just installed WAMP 3 on Windows 10 and had this issue.
I had to go to C:\wamp64\bin\php\php7.0.0\ and copy the php.ini file to C:\wamp64\bin\apache\apache2.4.17\bin\
Then I restarted WAMP, and was finally able to access my phpMyAdmin file.
Note: this is probably not the correct way to do this because now there are 2 php.ini files. There is probably a setting in an Apache file that points to the php.ini file, but I haven't seen that yet. I will update this if I find it.
Strangely, I noticed that the php.ini file that WAMP was using wasn't the one in the php directory, but rather was referencing a php.ini file in the bin directory... I copied my php.ini file to wamp\bin\apache\apache2.4.17\bin directory, restarted the wamp services and PHPMyadmin was off and running...
In newer versions of PHP, "extension_dir" is not initially enabled.
In php's directory try change extension of configuration file (php.ini-development - default value of this file). I changed it to php.ini and phpmyadmin has worked.
The program can't start because php_mbstring.dll is missing from your computer. Try to fix it.
i use appserver to localhost and my server: C:/AppServ/www/dvd2/variables.php
Mozilla/5.0 (Windows NT 6.1; rv:33.0) Gecko/20100101 Firefox/33.0
Apache/2.2.8 (Win32) PHP/5.2.6
To solve this problem on Linux, you need to recompile your PHP with the --enable-mbstring flag.
You might get this error message if you've just installed the phpmyadmin package but haven't restarted apache yet; try restarting apache.
Please uncomment the following lines at php.ini
;extension=php_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
;extension=php_mysql.dll
;extension=php_mysqli.dll
This will help to solve.
The version of phpadmin you have installed is not compatible with the version of apache. Install the compatible version and you should be fine
I recently updated from PHP 5.4.44 to PHP 5.6.12 on my Windows 8.1 OS and got this phpMyAdmin missing mbstring error message.
After trying the above suggestions, none of which worked for me, I discovered version 5.4.44 placed the DLL extensions in the PHP root directory whereas version 5.6.12 placed them in the PHP\ext subdirectory.
All very fine except unfortunately someone forgot to change the php.ini accordingly. So two possible solutions:
Copy the DLL extensions from the ext sub-directory into the PHP root directory, or
Edit the php.ini file to call all the DLL extensions from the ext sub-directory.
I chose the easier first and phpMyAdmin now works fine.
Depending on you OS, you might need to install additional packets, e.g. php5-mbstring in SLES Linux.
I check phpinfo() and look for this line:
Configuration File (php.ini) Path C:\Windows
And I copy php.ini from C:\xampp\php to the folder and it works for me.
I had the same problem, the above solutions are not worked for me.
What I did is uninstalled the wamp and logout the Skype and re-installed wamp.
Then It got worked. I think the port used by wamp and Skype is same.
Hope this input will help.
Cheers :)
my solution : Copy a shortcut from your php.ini from your php-directory to the apache-dir. This way you refere too 1 file on the correct place. This solved (at least in my case) the problem.
just copy the php.ini file from C:\wamp\bin\apache\apache2.4.17\bin to C:\wamp\bin\apache\apache2.4.17\bin and then again restart apache server..
it will work fine.
My solution:
I had wamp x32 installed before, needed to remove and then installed the x64, receiving the same message "The mbstring extension is missing. Please check your PHP configuration.".
On php.ini, all references to wamp, such as extension_dir = were pointing to "C:/Program Files/Wamp/...". Check all paths, the correct for me is "C:/Wamp64/". Restart services and it's all right now.
The installation process adds the phpMyAdmin Apache configuration file into the /etc/apache2/conf-enabled/ directory, where it is read automatically. The only thing you need to do is explicitly enable the mbstring PHP extension, Because sometimes you forgot to enable the mbstring mode so simply type the below command to enabled the mbstring mode...
sudo phpenmod mbstring
Afterward, restart Apache for your changes to be recognized:
sudo systemctl restart apache2
It may sound stupid, but I can't add extensions to my php.ini
let me explain.
on a script, I do a phpinfo(), it tells me my php.ini is at "/Library/Application Support/appsolute/MAMP PRO/conf/php.ini"
I open the file, check the extension dir, put my new extension there (mongo) make it executable.
I add "extension=mongo.so" after all other extension declarations, reboot the server ... and the extension doesn't load ... And nothing in the error log. (apache and php)
after many retries and even a complete reboot, it's still the same.
I tried to disable every extension that is loaded with it. and it's the same, all these extensions remain loaded.
Is there another place where it loads extensions ?
I use php 5.2.11 on Snow Leopard 10.6.4
in the main window of MAMP click File -> Edit Template and chose the php.ini you want to edit and add the mongodb extension there ..
save and restart MAMP and it should be loaded.
more info: http://www.davidgolding.net/mongodb/installing-mongodb-on-mamp-1-9-5.html
SOLUTION: restart your machine not just web server.
the same thing happened to me on mamp, and i restarted the machine, not just the web server and it loads. but you may run into client issue with php command in such case do this:
this is the solution for osx:
brew install php56-mongo
if it errors out then read the package name and re-run such as - example:
example: brew install php5789-mongo
source: http://php.net/manual/en/mongo.installation.php#mongo.installation.osx