Cannot load PostgresQL module in phpinfo() - php

Setting up Apache / Php / Postgres on Windows.
Apache is installed and service pages, Postgres is running fine, Phpinfo() works.
But I cannot seem to get the postgres module to show up in phpinfo() no matter what I try.
Path has been updated on windows to include
C:\Program Files\PostgreSQL\9.5\bin;C:\php;
These lines are uncommitted in php.ini and the correct ini is loading, and apache has been restarted...
extension=php_pdo_pgsql.dll
extension=php_pgsql.dll
Any ideas how to troubleshoot?
PHP Version 5.4.45
Apache is 2.4.18
PostgresQL is 9.5

Try to specify the full path to the .dlls in the php.ini

Related

Win10/Apache/PHP8: PHP cannot load pgql library [duplicate]

I'm installing PHP, Apache and PostgreSQL Manually
PHP and Apache now is connected, but PostgreSQL is not connected to PHP.
i test by using phpinfo();
i also configure in php.ini like this :
extension=php_pgsql.dll
extension=php_pdo_pgsql.dll
But why it's not work.
Thanks
This tutorial worked for me:
The PHP extension will look for libpq.dll which is found of your
PostgreSQL installation. The simple fix is to add the path than
contains that file to your environment PATH.
I had the same issue with PHP7 and Apache 2.4 on Windows 10. For me the solution was to add the following line to httpd.conf;
LoadFile "C:/php7/libpq.dll"
This also means that it's not required to have PostgreSQL installed if you just want to connect a PostgreSQL database that's not running on your machine.
1) Installing PostgreSQL for Windows
2) add to your enviroment variable "PATH" the bin folder of PostgreSQL installation:
C:\Program Files\PostgreSQL\9.2\bin; (for example)
Assuming you have installed PostgreSQL and your WAMP installation is on c:\wamp, you will need to copy
c:\wamp\bin\php\php5.3.9\libpq.dll to c:\wamp\bin\apache\Apache2.2.11\bin
Make sure you also have the following files
C:\wamp\bin\php\php5.3.9\ext\php_pdo_pgsql.dll and
C:\wamp\bin\php\php5.3.9\ext\php_pgsql.dll
Also, make sure you have enabled the above 2 files as extensions, either via the WAMP menu (click on WAMP icon on taskbar, PHP, PHPExtensions, find the above 2 and 'check' them)
Please note that php5.3.9 and Apache2.2.11 refer to my specific PHP and Apache versions.
Adjust those to suit your installation.
That's it!
This worked for me on Windows:
Found php.ini in php folder.
Found this line and removed “;”.
;extension=php_pgsql.dll
in my case there are 2 php.ini, I had to uncomment extension pdo_pgsql in both php.ini
in php folder
in apache folder
both inside in wamp folder
If you are using PHP in IIS, using PHP Manager, enable this extension:
php_pgsql.dll

pgsql extension is not loading

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.

sqlsrv extension not showing up in phpinfo.

I'm using Win server 2k12, php 5.5.12, on wamp.
Edited php.ini (both on apache dir and php dir) to add php_sqlsrv_55_ts.dll and the php_pdo_sqlsrv_55_ts.dll, and configured the extension dir path correctly. Happily, wamp is showing up those extentions at the PHP extension menu, and after ticking it and restarting all services, phpinfo is not showing up these changes! Not in the registered PHP streans entry, no anywhere.
Do you have any idea why?
Thanks in advance.

How to configure enable php_pdo_mysql on php5.5.12 and Apache 2.4

After uninstalled IIS from the server, I installed Apache 2.4 64-bit on Windows Server 2008 R2. Additionally, I installed PHP 5.5.12 64-bit.
I followed the instructions on this this "How install Apache 2.4 and PHP"
Everything seems to be fine. But What I am having difficulty with is enabling the php_pdo_mysql. I uncommented both lines in the php.ini file located on c:/php/php.ini
extension=php_mysql.dll
extension=php_mysqli.dll
Then I rebooted the Apache server "for the services list" but the pdo_mysql extension is not loading it as it should.
here are some snapshots from my php info
More, this is the output on the
shell>php -m
here are the files from my server
What else do I need to do to enable pdo_mysql?
What else can I check for?
Thank you
I figure out the problem.
I need to add the following to windows environment variables
;c:\php;c:\apache24;c:\apache24\bin;
After that rebooted Apache and it worked with no issues.
You must load the PDO dll, not the default mysql extensions.
Add the following two lines to your configuration:
extension=php_pdo.dll
extension=php_pdo_mysql.dll
These lines load the PDO extensions. Your lines load the MySQL and MySQLi extension.

Cant find the database driver for MediaWiki during installing

MYSQL and apache server are already installed on my server.
But still I encountered these problem.
I dont understand the terms to compile php with --with-mysql
Where should i compile? i am using window server.
or how to install the mysql.so module??
Checking environment...
Please include all of the lines below
when reporting installation problems.
PHP 5.2.14 installed Could not find a
suitable database driver! For MySQL,
compile PHP using --with-mysql, or
install the mysql.so module For
PostgreSQL, compile PHP using
--with-pgsql, or install the pgsql.so module For SQLite, compile PHP using
--with-pdo_sqlite, or install the pdo_sqlite.so module For MSSQL,
compile PHP using
--with-mssql_not_ready, or install the mssql_not_ready.so module For DB2,
compile PHP using --with-ibm_db2, or
install the ibm_db2.so module For
Oracle, compile PHP using --with-oci8,
or install the oci8.so module
Look in /php_install_dir/extensions. There should be a file named "php_mysql.dll". If so, enable it in php.ini. If not, download the dll, copy it to the extension dir and enable in php.ini. Remember to restart Apache.
See this page for more info (make sure you read the comments).
Changed this in php.ini. Shouldn't the installer have done this for a Windows installation?
; enable_dl = Off
; CHANGED - This is necessary to enable dynamic loading of Windows .dll modules
; The immediate problem was that PHP could not find a database driver for MySQL
enable_dl = On
For PHP: 5.6.10 and MySQL: 5.0.24a
Go to the root folder of PHP installation
Find a file called php.ini-production
Save the file as php.ini
Edit the file and uncomment the following contents
;extension=php_mysqli.dll
;extension_dir = "ext"
and replace it with,
extension= php_mysqli.dll
extension_dir = "D:\Programs\php\ext”

Categories