The Developer Day | Staying Curious

Jun/07

18

PHP5 upgrade - DLL & version issues

Recently I tried to update my PHP 5.2.0 version to 5.2.3 on my Windows XP machine. After the upgrade I found that phpinfo() would still show the previous version of PHP 5.2.0. Though running the “php -version” at the command line would work fine saying that my php version is 5.2.3. Later that day I also noticed that I’m unable to connect to MySQL.

Fatal Error: undefined function mysql_connect()

Though, running php -m at the command line would say, that mysql extension is ready and loaded. And phpinfo() would show it as not loaded. After checking apache’s logs/error.txt i found that php is unable to load quite a few of the php.ini enabled extensions.

PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_curl.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_mcrypt.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_mhash.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_mysql.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_mysqli.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_soap.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_xmlrpc.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0

I started googling on the matter to find out what went wrong with the upgrade. After reading a PHP bug report I realized that it might have something to do with my windows/system32 dlls. Then I found php5ts.dll in the windows/system32 directory.

It became clear to me, that PHP CLI version was using the the DLL’s from the php directory and PHP as an Apache module was loading them from the windows\system32 directory. I deleted all of the DLLs that are in the PHP directory from the windows/system32 directory and added PHP directory path to PATH environment variable and everything seems to work fine now.

My personal advice is not to put any of PHP DLL’s in the windows/system32 directory. You may really forget you have them there and become confused why things have started acting strangely.

RSS Feed

8 Comments for PHP5 upgrade - DLL & version issues

Dirk Beer | August 14, 2007 at 11:57 PM

awesome, thank you!

James | August 27, 2007 at 5:30 PM

You are a legend, saves my computer from a quick leap out the window!

SabbeRubbish | September 12, 2007 at 9:26 PM

Oh my god man, thank you SO very much for ranking high enough in Google for me to find your article!

Life-saver, and I really hate windows now!

zhaiduo | September 27, 2007 at 4:43 AM

I try it as you said, but it not work for me. ;-(

Ami | September 30, 2007 at 9:39 PM

thanks a lot. you saved my day as well!

Mike | December 12, 2007 at 1:25 PM

I had a similar problem after installing vtiger CRM, it had put older php and mysql dlls in my Apache bin directory

Rene | November 20, 2008 at 11:15 PM

I wish it would work for me.

I got PHP 5.2.6 running with Apache and I cannot get this to work. If you got any ideas to solve it, feel free to contact me

Akim | February 1, 2012 at 7:05 AM

I read BUG report http://bugs.php.net/bug.php?id=24621 and understand my mistake
Thank you.

Leave a comment!

<<

Find it!

Theme Design by devolux.org