pgsql extension is not loading - php

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.

Related

cURL not working - show PHP the files in PHP directory - NOT Windows configuration

I'm running Windows 10 x64 and the latest version of PHP 7.
I have removed the semicolon from extension=php_openssl.dll in the php.ini file.
The file PHP\ext\php_curl.dll exists.
The files PHP\libeay32.dll and PHP\ssleay32.dll exist.
I know I need to restart the HTTP server for PHP to see the files after I do the last step.
I explicitly do not want to dump the files in to a Windows directory as I routinely reinstall Windows and I simply migrate everything as portable between OS installs with zero negative effects.
How do I update PHP to see the files in it's own directory?
I downloaded a slightly newer version of PHP, that didn't work.
Then I downloaded a newer version of Apache, migrated the older settings and that worked. This is the only relevant httpd.conf settings I've changed:
LoadFile "C:/WAMP/Apache/bin/libeay32.dll"
LoadFile "C:/WAMP/Apache/bin/libssh2.dll"
LoadFile "C:/WAMP/Apache/bin/ssleay32.dll"

How to get curl working on win 10 , wamp php 7.2?

I tried everything I could find like instructions here
How to get CURL to work with PHP on Windows? (WAMP)
to copy dll files from php7.2.0 folder to apache2.4.18\ bin folder
my setup
win 10 64
wamp 3.1.1
php, 5.6.28, 7.0.4, 7.2
apache 2.4.18
curl works on any other php version but not on 7.2
cheeked extension_dir path and it points to right dir
extension_dir ="T:/wamp64/bin/php/php7.2.0/ext/"
loaded php 7.2 extensions
extension=bz2
extension=curl
;extension=dba
extension=com_dotnet
;extension=enchant
extension=fileinfo
;extension=ftp
extension=gd2
extension=gettext
extension=gmp
extension=intl
extension=imap
;extension=interbase
extension=ldap
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
;extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=phpdbg_webhelper
;extension=shmop
now I see that in 7.0.4 there was php_ prefix and dll suffix
extension=php_curl.dll
but this is in the 7.2 info
; When the extension library to load is not located in the default extension
; directory, You may specify an absolute path to the library file:
;
; extension=/path/to/extension/mysqli.so
;
; Note : The syntax used in previous PHP versions ('extension=<ext>.so' and
; 'extension='php_<ext>.dll') is supported for legacy reasons and may be
; deprecated in a future PHP major version. So, when it is possible, please
; move to the new ('extension=<ext>) syntax.
;
; Notes for Windows environments :
;
; - ODBC support is built in, so no dll is needed for it.
; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.
someone else had the same issue but there was no solution http://forum.wampserver.com/read.php?2,149346,149609#REPLY
Solution that worked for me
Install Apache 2.4.29,
for some reason 2.4.18 was not loading php 7.2 curl
Hope this will help someone. I spent 4 hours finding a solution for this problem and nothing I found was effective.
So what I did was (Windows 10 x64 + Apache 2.4.29):
I downloaded php 7.2 for windows from the PECL and uncommented and
changed the
;extension=curl
to
extension=php_curl.dll
Copied the libssh2.dll from the php folder to the Apache24/bin folder.
And it worked!!!
Of course changed the Windows PATH variable pointing to the old php version folder to the new folder.
I read some comments that it's not a good idea of copy and paste the file but this was the only option which worked for me.
I wanted to use cURL with php 7.2 and apache 2.4.39 so here are the steps that worked for me for WAMPSERVER 64 BITS (X64) 3.17 on windows 10:
left click on the wamp icon in the tray > php > php extensions >
check the 'curl' option
copy the file C:\wamp64\bin\php\php7.2.18\libssh2.dll to
C:\wamp64\bin\apache\apache2.4.39\bin\libssh2.dll
left click on the wamp icon in the tray > restart all services
WINDOWS
Prior to PHP 7.2, curl and openssl required the following files in your root PHP folder (where NN is either 32 or 64 depending on your install):
libeayNN.dll
ssleayNN.dll
Those files are missing in 7.2. Now the following files are required for PHP 7.2 (part of 7.2 package):
libcrypto-1_1-xNN.dll
libssl-1_1-xNN.dll
In my case I had apache 2.4.21 and curl did not work with php 7.2 or 7.3.
By Updating the apache to 2.4.41 It is working now.
So updating apache is a good solution, if others did not work.
SOLVED
I am using wampserver 3.2.0 on windows 7. for some reasons Apache 2.4.33 and 2.4.43 were not loading curl.
I installed Apache 2.4.39 into wampserver and enabled the curl in php extentions.
now it's working.
The solution that worked for me:
Apache httpd version: Apache/2.4.43 (Win64)
for some reason 2.4.33 was not loading php 7.2 curl
If you are using wampserver , just go to
https://sourceforge.net/projects/wampserver/files/WampServer%203/WampServer%203.0.0/Addons/Apache/
Select the latest version and download and double click to install the addon automatically
GO to wamp and select the newly installed apache version.
It worked for me
I am using Apache 2.4.20 and php 7.2.23 under windows 10 x64 and have some trouble with how to activate curl. I tried any tutorial and I find some solution for this case.
Perhaps, my solution it works for all of you about how to activate curl library.
I change httpd.conf on Apache and add manualy syntax for load file of php 7.2.23 on my windows. This syntax on httpd.conf in my windows:
LoadFile "C:/WebServer/php-7.2.23/libssh2.dll"
LoadFile "C:/WebServer/php-7.2.23/libcrypto-1_1-x64.dll"
LoadFile "C:/WebServer/php-7.2.23/libssl-1_1-x64.dll"
LoadFile "C:/WebServer/php-7.2.23/ext/php_curl.dll"
Then restart apache web server. Finally, i check via browser solve. "CURL is Installed on this server" with php script to check curl library is active or not.
Good luck.

OpenSSL support disabled in Apache/PHP on Windows

openssl is disabled apache2.4 with php7.1
in phpinfo(); results give me this
OpenSSL support disabled (install ext/openssl)
i changed this in php.ini
extension=php_openssl.dll
i use this code using WINDOWS CMD
set OPENSSL_CONF=/path/to/openssl.cnf
its enabled when use in CMD this but its disabled in phpinfo();
php --ri openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.2j 26 Sep 2016
Openssl default config => C:/jampp/php71/extras/ssl/openssl.cnf
its now working in CMD and but phpinfo(); not and in laravel 5 show me this error
Call to undefined function openssl_encrypt()
Thanks
Thank you all its just need includes the (DLLs files of php) into httpd.conf
LoadFile "C:/jampp/php/libeay32.dll"
LoadFile "C:/jampp/php/ssleay32.dll"
LoadFile "C:/jampp/php/php7ts.dll"
LoadFile "C:/jampp/php/libpq.dll"
Another possible solution for anyone struggling to enable OpenSSL on Windows. Run php --ini to check whether your ini file is being ran. In my case the configuration file was set to none.
My php installation came with development and production ini files, but I needed to create a new ini file called php.ini and include my settings there.
If anyone else is struggling to install composer, this fix may work for you :)
Updated Answer 2021:
OpenSSL is in version 1.1 now. The LoadFiles file in another answer on this page have been replaced by 'libcrypto-1_1.dll' and 'libssl-1_1.dll'.
Honestly, though, that entire answer is probably outdated. In my case, the solution was far simpler. Everything I found on the internet says all you have to do is uncomment the line 'extension=openssl' in your php.ini file. However, there is usually a small piece of information omitted. You ALSO need to uncomment the line 'extension_dir = "ext"' on Windows or 'extension_dir = "./" on Linux. If you don't do this, then no extensions can load.
I have added new php version 8.2.1 today
uncommented extension_dir = "ext"
uncommented extension=openssl
Wamp control manager shows that openssl is enabled
4. Exit wamp and also restarted All services
Still the Problem persisted on phpinfo() and phpmyadmin
The solution worked for me after all is to Restart my laptop

Cannot load PostgresQL module in phpinfo()

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

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.

Categories