Question

I have upgraded to PHP 5.3 on a development machine (Windows 7 box).

php-v shows

PHP 5.3.3 (cli) (built: Jul 21 2010 20:36:55)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

However, phpinfo.php shows that the version on the machine is: 5.2.14 as shown dump from phpinfo page

The loaded configuration file rightly loads the correct php.ini file for 5.3 The configuration file (php.ini) Path wrongly reads: C:\Windows - I don't install PHP on the said path. I have however done a recursive search of PHP folders and files within that file but the search turned up nothing.

Applications seem to use the settings reported by the phpinfo and not by php -v or php -m or php -i (or else).

Apart from deleting the PHP folder and starting from scratch (which I have done), and ensuring that Apache points to the right PHP dir using PHPINIDir, what could I possibly do to solve this? Thanks.

Was it helpful?

Solution

Hello

You should also update apache php module


@soju - that fixed it, thanks, but I thought I'd make this a little clearer for others.

Apache requires the php module to serve php files. On Windows it comes as a .dll file. This would be called: php5apache2_2.dll - located within your php folder. Strangely though, during upgrading the php folder with a newer version, you may find out that apache still uses the old php module file. So while php -v correctly reports the new version, Apache still looks at the old php module (reported by phpinfo). To find out what module version you have, you could: right-click on the .dll file > select properties -> view the details tab. Or just hover on the file.

details screen of php5apache.dll file

If this version is not what you want, you might want to hunt for a newer version and replace it. Good idea to back up first. Also, the php5apache.dll file works with and requires the file: php5ts.dll - so ensure these files are the same versions.

With your httpd.conf file with the directive:

LoadModule php5_module "\path to\php5apache2_2.dll"

You may restart apache and smile!

OTHER TIPS

Your command line (CLI) php is an other version than the one used for Apache. Check also that both use the same php.ini. When you call on your Windows machine

c:\path\to\php\php.exe -v 

or

c:\path\to\php\php-win.exe -v 

and

c:\path\to\php\php-cli.exe -v 

They all can return different versions. Often this happens when upgrading to a new WAMP version and forgetting to delete the old versions. I'm sure you will find the executable PHP binary which matches the same version. It is also save to use the php.exe or php-win.exe instead the php-cli.exe on Windows.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top