KP Solutions

Solutions for Day to Day Technical Problems

Unable to load dynamic library php_mysql.dll


While trying to setup Apache, PHP and MySql on your development machine or server, you may face several hurdles and one of them would be unable to load the mysql library. On my windows development machine, I got a problem while trying to load mysql library. I got following error:

PHP Warning:  PHP Startup: Unable to load dynamic library ‘./php_mysql.dll’ – The specified module could not be found.\r\n in Unknown on line 0

The problem is two fold here:

  1. The extension directory path is incorrect
  2. And php module isn’t able to find libmysql.dll

To resolve the issue:

  1. Update ‘extension_dir’ from ‘./’ to ‘G:/Server/php/ext/’
  2. Update the ‘PATH’ variable on your computer to include the PHP directory (G:\Server\php) in my case.

Hope this will save you time and trouble of finding a proper solution.