This is an alternate resolution to the above error message if
you are trying to connect to a MySQL database locally on a Windows
XPSP2 PC through Dreamweaver 8(8.0.2). Hopefully this can help
someone.
BACKGROUND:
Installed Apache 2.24 first, then PHP 5.21 through the
php-5.2.1-win32-installer.msi file & finally MySQL 5.0.37 for
local site testing for web development onto a Windows XP SP2 PC.
The key here was that PHP 5.21 was installed using the .msi file
versus downloading then extracting the contents of the
php-5.2.1-Win32.zip file into a folder on my PC. Since I installed
from the .msi file, I noticed 2 things after some research. First,
the ext folder, where PHP extensions are referenced was not
installed, secondly the libmysql.dll file was not installed with
the msi file. The libmysql.dll file is also included in the
php-5.2.1-Win32.zip file. This file seems to come into play later,
as you will see. I confirmed Apache worked with localhost test(go
to
http://localhost make sure you see It
works! on the webpage), confirmed php worked with phpinfo
test(create a file named file.php with the following contents in
the code <?php phpinfo(); ?> this file will show you php
configuration information then I confirmed that MySQL was starting
the MySQL service as needed and I could login without issue as the
root user.
- Next, I proceeded to try to connect to a MySQL database
through Dreamweaver 8(8.0.2) on my PC. I received the “Your
PHP server doesn’t have the MySQL module loaded or you
can’t use the mysql_(p)connect functions.” error
message.
- Next, I checked my php.ini file(located in your PHP
installation folder) to see if the extension_dir value was set to
reference the folder where my PHP extensions would reside and if
the extension=php_mysql.dll was enabled and accessible to PHP so
that it could interface to MySQL. The extension_dir value was
pointing to ‘./ ’ . Next, I proceeded to search my
local hard drive where PHP was installed for the ext folder, where
PHP extensions reside. To my surprise, this folder was not found.
After some searching online, I discovered that the ext folder was
in the php-5.2.1-Win32.zip file that can be downloaded from the PHP
site. So I proceeded to download this file to my PC, extract the
contents of the file into a folder then copy the ext folder into my
PHP installation folder. In my instance, PHP was installed to
E:\Program Files\PHP\ and I copied the ext folder here. So it was
located here; E:\Program Files\PHP\ext. Now I had to go back to my
php.ini file and specify the location of the ext folder, I did
that, checked the phpinfo page for the location where extension_dir
was pointing, it was still referencing ‘ ./ ’ . I
proceeded to restart my PC, then I checked this value once again
after a reboot and it was pointing to the correct
location(E:\Program Files\PHP\ext).
- Next, I needed to confirm that the extension=php_mysql.dll
was enabled in the php.ini file, it was commented out(
;extension=php_mysql.dll ), I removed the comment(
extension=php_mysql.dll ) and tried to connect to the MySQL
database again through Dreamweaver and it still gave the same error
message as above.
- I went online again and searched the PHP site in relation
to setting it up with MySQL 5 and PHP 5. The site stated that the
PHP installation location should be the first value specified in
the PATH variables on your Windows system. I checked this by going
to Control Panel->System->Advanced->Environment Variables
then in the System Variables section I confirmed that the Path
Variable had the E:\Program Files\PHP\; value listed first, this is
needed according to the PHP site and I confirmed this. Secondly, I
confirmed that there was a variable named PHPRC pointing to my PHP
installation location
(E:\Program Files\PHP\ ). This was also listed as something
that should be specified.
- The PHP site also stated that the libmysql.dll file is
needed in your C:\Windows\System32 folder. Next step was to search
my PC for this file, it was not in C:\Windows\System32 or in my PHP
installation folder. However, this file was located in the folder
that contained the extracted files from the php-5.2.1-Win32.zip
file. I proceeded to copy the libmysql.dll file into
C:\Windows\System32, tried to connect to MySQL in Dreamweaver 8
again, still the same error message as above. Then, I thought I
should try to Stop my Apache server, then Start it. After this was
done, I tried to connect to the MySQL in Dreamweaver 8 and this
time it worked.
- This is a long and winded explanation, but I believe that
each of the steps are necessary to confirm that you have the
prerequisite functionality and files for this setup(Apache 2.24,
PHP 5.21, MySQL 5.0.37) to work on a Windows PC. I wanted to post
this online to save people frustration if they encountered the
specific error as I did. I had read that other people downgraded to
PHP 4 and this resolved the problem, but that didn’t cut it
for me. I have used XAMPP, a free local development environment and
found this much simpler to install and start to use than the above
configuration. But for those who have the problem I had, I hope my
steps helped. If you find a fix, post it online to help others.