I am trying to load a MySql extension for PHP development.
Running <?php phpinfo(); ?>
I can see that the MySql extension is not loaded. This is also apparent when running a script that uses the mysql_connect
function and receiving the error Fatal error: Call to undefined function mysql_connect() in C:\Apache24\htdocs\test.php on line 11
.
Running php --ini
I receive an output of:
Loaded Configuration File: C:\php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
So when I edit my php.ini file in order to enable the MySql extension I know I am editing the correct .ini file. The output of phpinfo()
points to the same file.
In my php.ini file I have changed
;extension=php_mysql.dll
to
extension=php_mysql.dll
For my extension directory in my php.ini file:
extension_dir = "./ext"
within that directory I do have the php_mysql.dll
file.
I am at a bit of a loss here and don't really know what I am missing. Every answer I have found on the SE sites and elsewhere just point to uncommenting a line in the php.ini file and checking that the extension_dir is pointing to a location that contains the correct .dll file.
What am I missing to properly load this extension?
Any assistance would be much appreciated.
Best Answer
A common cause of this can be php's install directory not being included in the
PATH
environment variable ( See: PHP: Installation of Extensions in Windows ), which causes the php module to fail to find mysql.Any error in the logs about failure to load the extension?