Windows – PHP 5.3.2 Upgrade on Windows

PHPwindows

I have a development box running Windows XP, Apache 2.2.15 Mysql and PHP 5.2.6

About a month ago I updated the Apache to the latest version and it went swimmingly. I am not having the same success with upgrading PHP to the latest version.

I backed up my PHP directory and then deleted it. Used the Windows Installer for PHP 5.3.2, installed as an Apache 2.2.X module. I can get "Hello World" and phpinfo() to come up but cannot get mysql to connect. I have the extension un-commented in the php.ini and shouldn't really have to touch the Apache httpd.conf file since I didn't change the directory of PHP.

Not sure what I'm doing wrong here. I have to get this right and then upgrade the Live Server too so I want to get this down pat.

I've tried to use installation guides on the web with no luck. Any info pertaining to this problem would be great. I'm also afraid that the other PHP modules may not load but cannot really tell anything past mysql not working.

This is what appears in phpinfo()

mysqlnd
mysqlnd enabled
Version     mysqlnd 5.0.7-dev - 091210 - $Revision: 294543 $
Compression     supported
Command buffer size     4096
Read buffer size    32768
Read timeout    31536000
Collecting statistics   Yes
Collecting memory statistics    No 

I cannot figure out how to enable mysql, mysqli etc. though they seem to be installed.

Best Answer

Since you're getting the error Fatal error: Call to undefined function mysql_connect(), that means that the MySQL extension is not being loaded by PHP. This is configured in your php.ini file.

To find the location of your php.ini file, create a php file and in it paste the following.
<?php phpinfo(); ?>

On the page (near the top) you will have an entry labelled Loaded Configuration File. Check this file that has been loaded is actually the one that you expect it to load. Personally, mine loads from C:/php/php.ini, but if I recall correctly when I was initially setting it all up, it was trying to read from C:/Windows/php.ini (which didn't exist) so was using defaults for everything, which didn't include some of the extra modules I wanted.

Open that file with your favourite text editor and in there should be several lines beginning extension=xxxxx.dll.

Look through the list of modules and check that extension=php_mysql.dll is listed and the first character of the line is not a semi-colon (;). If it's not listed, just add it to the list - if it has the semi-colon at the beginning of the line, remove the semi-colon and save the file.

You should also check the value of extension_dir, and also verify this path exists on the filesystem. This should be something similar to c:/php/ext.

Once you've made changes to the php.ini file, you will need to restart Apache so the configuration file is re-read.

Once you've restarted Apache, refresh your phpinfo page and check that it has sections listed for MySQL.

You might also want to check if C:\php is included in your PATH environment variable.

If you're still having issues, try firing up a command line and cd to C:\php and type php -v. This will output the PHP version, but will often spit out more error messages than are shown when loading a web page

Related Topic