I am running the latest version of PHP (currently 5.6.22) on OSX El Capitan and Apache server.
I am trying to use PostgreSQL database and actually, yesterday already worked but after I haver overridden httpd.conf file with a default one (I guess this is the problem) I got this message:
Call to undefined function pg_connect() in ...
The thing is that I haven't changed php.ini file. If I run phpinfo(); I get etc/php.ini for a Configuration File. So I am positive that Apache choose the right php.ini file and that correct extensions are loaded:
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
What can cause this error ? Also I have installed pgAdmin 3 and I can successfully run SQL queries on created database (which I have used yesterday for this site I am working on).
EDIT:
This is what I get in error_log file when I restart Apache server and try to run that specific page (which calls pg_connect):
[Thu Jun 02 15:28:15.595496 2016] [mpm_prefork:notice] [pid 476]
AH00169: caught SIGTERM, shutting down [Thu Jun 02 15:28:16.515774
2016] [so:warn] [pid 670] AH01574: module php5_module is already
loaded, skipping PHP Warning: PHP Startup: Unable to load dynamic
library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/php_curl.dll' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_curl.dll,
9): image not found in Unknown on line 0 PHP Warning: PHP Startup:
Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/php_mbstring.dll' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_mbstring.dll,
9): image not found in Unknown on line 0 PHP Warning: PHP Startup:
Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/php_mysqli.dll' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_mysqli.dll,
9): image not found in Unknown on line 0 PHP Warning: PHP Startup:
Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/php_pdo_pgsql.dll'
- dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_pdo_pgsql.dll,
9): image not found in Unknown on line 0 PHP Warning: PHP Startup:
Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/php_pdo_sqlite.dll'
- dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_pdo_sqlite.dll,
9): image not found in Unknown on line 0 PHP Warning: PHP Startup:
Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/php_pgsql.dll' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_pgsql.dll,
9): image not found in Unknown on line 0 PHP Warning: PHP Startup:
Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/php_soap.dll' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_soap.dll,
9): image not found in Unknown on line 0 PHP Warning: PHP Startup:
Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/php_sockets.dll' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_sockets.dll,
9): image not found in Unknown on line 0 PHP Warning: PHP Startup:
Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/php_sqlite3.dll' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_sqlite3.dll,
9): image not found in Unknown on line 0 [Thu Jun 02 15:28:16.615703
2016] [mpm_prefork:notice] [pid 670] AH00163: Apache/2.4.18 (Unix)
PHP/5.5.31 configured -- resuming normal operations [Thu Jun 02
15:28:16.615786 2016] [core:notice] [pid 670] AH00094: Command line:
'/usr/sbin/httpd -D FOREGROUND' [Thu Jun 02 15:28:20.869683 2016]
[:error] [pid 674] [client 127.0.0.1:49594] PHP Fatal error: Call to
undefined function pg_connect() in
/Library/WebServer/Documents/site/database.php on line 10
This happens when your pgsql extension is not installed or is not compatible with your current server build (x86/x64).
Check if you have the correct file in you ext folder: php_pgsql.so (or php_pgsql.dll if youre running on windows)
Search for the line extension=php_pdo_pgsql.dll in your php.ini. Then just add it if not found or remove the comma if its commented
Run phpinfo() and check if the extension is enabled
If you found it, its good to go
Related
i am trying to enable my local development environment, and i have the Apache, PHP and MariaDB already installed in my Big Sur Mac. (all installed with brew)
But the imap php extension does not work and that's because the PHP is not loading the extension.
The Apache error_log throws:
PHP Warning: PHP Startup: Unable to load dynamic library 'imap'
(tried: /usr/local/lib/php/pecl/20190902/imap (dlopen(/usr/local/lib/php/pecl/20190902/imap,
9): image not found), /usr/local/lib/php/pecl/20190902/imap.so
(dlopen(/usr/local/lib/php/pecl/20190902/imap.so, 9): image not found)) in Unknown on line 0
[Sun Jan 17 09:30:08.936003 2021] [mpm_prefork:notice] [pid 2187] AH00163: Apache/2.4.46
(Unix) PHP/7.4.14 configured -- resuming normal operations
[Sun Jan 17 09:30:08.936124 2021] [core:notice] [pid 2187] AH00094: Command line:
'/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
brew list command throws:
imap-uw, php#7.4, ........
Thanks in advance guys
MacOS BigSur 11.1
The extension is right here (with instructions):
shivammathur Homebrew Extensions
I get the error message in the question's title, or to be exact I get this message
PHP Startup: Unable to load dynamic library 'openssl'
(tried: /usr/lib/php/20170718/openssl (/usr/lib/php/20170718/openssl:
cannot open shared object file: No such file or directory),
/usr/lib/php/20170718/openssl.so (/usr/lib/php/20170718/openssl.so: cannot
open shared object file: No such file or directory)) in Unknown
My real issue with this is that it only occurs sometimes and not always. In one second a request works and in the other, I get a 500 internal error with this message on the same request.
This started to occur after I enabled the apache proxy and proxy_wstunnel mods but could also have been an apt-get upgrade or apt-get update.
From phpinfo();:
Version: PHP Version 7.2.4-1+ubuntu16.04.1+deb.sury.org+1
OpenSSL support enabled
OpenSSL Library Version OpenSSL 1.1.0h 27 Mar 2018
OpenSSL Header Version OpenSSL 1.1.0h 27 Mar 2018
Openssl default config /usr/lib/ssl/openssl.cnf
If you need futher information feel free to task.
Edit:
From apache error.log
PHP Warning: PHP Startup: Unable to load dynamic library 'openssl' (tried: /usr/lib/php/20170718/openssl (/usr/lib/php/20170718/openssl: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/openssl.so (/usr/lib/php/20170718/openssl.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[Fri Apr 20 06:25:01.973125 2018] [mpm_prefork:notice] [pid 2872] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Fri Apr 20 06:25:01.973154 2018] [core:notice] [pid 2872] AH00094: Command line: '/usr/sbin/apache2'
[Fri Apr 20 06:34:04.715749 2018] [php7:error] [pid 3490] [client 5.146.199.236:41654] PHP Fatal error: Uncaught yii\web\HeadersAlreadySentException: Headers already sent in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php on line 414. in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php:366\nStack trace:\n#0 /var/www/html_back/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()\n#1 /var/www/html_back/vendor/yiisoft/yii2/web/ErrorHandler.php(135): yii\web\Response->send()\n#2 /var/www/html_back/vendor/yiisoft/yii2/base/ErrorHandler.php(262): yii\web\ErrorHandler->renderException(Object(yii\base\ErrorException))\n#3 [internal function]: yii\base\ErrorHandler->handleFatalError()\n#4 {main}\n thrown in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php on line 366
[Fri Apr 20 06:34:58.208208 2018] [php7:error] [pid 3486] [client 5.146.199.236:41681] PHP Fatal error: Uncaught yii\web\HeadersAlreadySentException: Headers already sent in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php on line 414. in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php:366\nStack trace:\n#0 /var/www/html_back/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()\n#1 /var/www/html_back/vendor/yiisoft/yii2/web/ErrorHandler.php(135): yii\web\Response->send()\n#2 /var/www/html_back/vendor/yiisoft/yii2/base/ErrorHandler.php(262): yii\web\ErrorHandler->renderException(Object(yii\base\ErrorException))\n#3 [internal function]: yii\base\ErrorHandler->handleFatalError()\n#4 {main}\n thrown in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php on line 366
I had the same problem.
It seems like i created it by manually enable
extension=openssl
in the php.ini. After disable it again everything looked fine
php -i | grep -i openssl
SSL Version => OpenSSL/1.1.0g
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.1.0g 2 Nov 2017
OpenSSL Header Version => OpenSSL 1.1.0g 2 Nov 2017
Openssl default config => /usr/lib/ssl/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
Native OpenSSL support => enabled
I have downloaded PHP driver for mongodb from https://pecl.php.net/package/mongodb
Then I have copied php_mongodb.dll in xampp/php/ext folder
and also added extension=php_mongodb.dll in php.ini file
But still mongodb extension in not loading, it is not showing in phpinfo().
In the PHP error log file I find this PHP Warning:
PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_mongodb.dll' - %1 is not a valid Win32 application.\r\n in Unknown on line 0 [Wed Apr 19 11:09:54.445878 2017] [mpm_winnt:notice] [pid 2120:tid 268] AH00354: Child: Starting 150 worker threads.
Please help.
I am running windows 7 on 64 bit
Apache 2.4.4 is not loading two modules. The modules exist in the directory where it is looking.
I'm using Windows 8.1, PHP 5.4.12, and a WAMPServer installation.
[Thu Oct 20 19:12:33.092619 2016] [mpm_winnt:notice] [pid 6888:tid 548] AH00418: Parent: Created child process 3172
PHP Warning: PHP Startup: Unable to load dynamic library 'm:/wamp/bin/php/php5.4.12/ext/php_pdo_pgsql.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'm:/wamp/bin/php/php5.4.12/ext/php_pgsql.dll' - The specified module could not be found.\r\n in Unknown on line 0
[Thu Oct 20 19:12:33.319122 2016] [mpm_winnt:notice] [pid 3172:tid 448] AH00354: Child: Starting 150 worker threads.
My PHP, Apache, and PostgreSQL are all 64 bit.
I added the directory (m:\PostgreSQL\9.3\lib) that includes libpq.dll to my Path and then restarted but it didn't help.
I also tried copying libpq.dll into the Apache bin directory.
Are there any other dependencies?
I fixed it by adding the PostgreSQL bin directory to the Path (Environmental Variable).
for my case PHP 7.2.26 , it was under:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
on php.ini such that ;extension=pgsql becomes:
extension=pgsql
I was working on development environment containing PHP5 and Codeigniter using Apserve pack. I wanted to upgrade to PHP 5.3 so I downloaded the ZIP file and unpack it in c:\apserve\php5 directory. after this things got really crazy and messy.
PHP didn't worked at all, even though apache is working. the only page is working is http://localhost/, while phpmyadmin http://localhost/phpmyadmin and http://localhost/ci folder don't load at all. This link is shown in linkbar in my browser when I'm trying to get to phpmyadmin locally.
so how can I reconfigure php to get it working??
notes:
php.ini located in windows folder and c:\apserve\php6 folder.
php folder has two location; c:\programfiles\php6 and c:\apserve\php6.
I want to use c:\apserve content only.
this is my error log after removing previous errors and clean start up.
[Sun Apr 10 17:48:06 2011] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
PHP Warning: Directive 'register_globals' is no longer supported in PHP 6 and greater in Unknown on line 0
PHP Warning: Directive 'register_long_arrays' is no longer supported in PHP 6 and greater in Unknown on line 0
PHP Warning: Directive 'magic_quotes_gpc' is no longer supported in PHP 6 and greater in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_curl.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_exif.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_gd2.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_mbstring.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_mysqli.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_openssl.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_pdo.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_pdo_sqlite.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_sockets.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_sqlite.dll' - The specified module could not be found.\r\n in Unknown on line 0
[Sun Apr 10 17:48:07 2011] [notice] Apache/2.2.8 (Win32) mod_ssl/2.2.8 OpenSSL/0.9.8g PHP/6.0.0-dev configured -- resuming normal operations
[Sun Apr 10 17:48:07 2011] [notice] Server built: Jan 18 2008 00:37:19
[Sun Apr 10 17:48:07 2011] [notice] Parent: Created child process 4872
[Sun Apr 10 17:48:07 2011] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
PHP Warning: Directive 'register_globals' is no longer supported in PHP 6 and greater in Unknown on line 0
PHP Warning: Directive 'register_long_arrays' is no longer supported in PHP 6 and greater in Unknown on line 0
PHP Warning: Directive 'magic_quotes_gpc' is no longer supported in PHP 6 and greater in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_curl.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_exif.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_gd2.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_mbstring.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_mysqli.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_openssl.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_pdo.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_pdo_sqlite.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_sockets.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/AppServ\\php5\\ext\\php_sqlite.dll' - The specified module could not be found.\r\n in Unknown on line 0
[Sun Apr 10 17:48:07 2011] [notice] Child 4872: Child process is running
[Sun Apr 10 17:48:07 2011] [notice] Child 4872: Acquired the start mutex.
[Sun Apr 10 17:48:07 2011] [notice] Child 4872: Starting 64 worker threads.
[Sun Apr 10 17:48:07 2011] [notice] Child 4872: Starting thread to listen on port 80.
There is contradicting information in that log output, it seems to me you are loading php5 extensions in php6.
Have you tried removing all installations of php and installing only the one you need.
If you really must have multiple versions of php running, have you considered virtualising your dev environments?
Be sure you have enabled all extensions (MySQL in particular) in php.ini.
If you have backup of your previous PHP installation (folder), I'd recommend to copy & overwrite php.ini file.
Also check the Apache error_log files (in your apache folder) and see errors there, as apache would log any PHP error during start up.