PHP extensions won’t load on Apache startup

apachePHPwindows

I've added php as a module for Apache 2.2.11:

LoadModule php5_module "c:/php/php5apache2_2.dll"

And also added

AddType application/x-httpd-php .php

And in PHP.ini, my extension dir is set to: extension_dir = "C:\php\ext"

And yes, the directories are correct and all files do exist.

But when I start apache, I get these errors:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\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:\php\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 'C:\php\ext\php_pgsql.dll' – The specified module could not be found.\r\n in Unknown on line 0

[Sun May 17 03:46:01 2009] [notice] Apache/2.2.11 (Win32) PHP/5.2.9-2 configured — resuming normal operations
[Sun May 17 03:46:01 2009] [notice] Server built: Dec 10 2008 00:10:06
[Sun May 17 03:46:01 2009] [notice] Parent: Created child process 4652

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\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:\php\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 'C:\php\ext\php_pgsql.dll' – The specified module could not be found.\r\n in Unknown on line 0

[Sun May 17 03:46:01 2009] [notice] Child 4652: Child process is running
[Sun May 17 03:46:01 2009] [notice] Child 4652: Acquired the start mutex.
[Sun May 17 03:46:01 2009] [notice] Child 4652: Starting 64 worker threads.
[Sun May 17 03:46:01 2009] [notice] Child 4652: Starting thread to listen on port 80.

So I'm probably forgetting something simple here, can someone tell me what I'm forgetting?

Best Answer

Not only you need PHP extension's DLLs in order to add MySQL and PostgreSQL support to PHP. You also need MySQL and PostgreSQL native libraries. PHP extension's DLLs are probably not finding some DLL they depend on, so they can't start.

Make sure you have MySQL and PostgreSQL client installed, and their DLLs into some locatable place.

I.E. example:

  • php_mysql.dll depends on libmysql.dll

So, make sure PHP is able to find libmysql.dll (I believe this one comes with the binary distribution of Windows PHP. Not sure though).

Related Topic