The problem of different versions of PHP

I upgraded to PHP 5.3 on the developer's computer (Windows 7 window).

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 correctly loads the correct php.ini file for 5.3. The configuration file (php.ini) Path reads incorrectly : C: \ Windows - I do not install PHP at the specified path. However, I did a recursive search for folders and PHP files in this file, but the search did not find anything.

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

Besides deleting the PHP folder and starting from scratch (what I did) and ensuring that Apache points to the correct PHP directory using PHPINIDir, what can I do to solve this problem? Thanks.

+4
source share
2 answers

Hello

You should also update apache php module


@soju - this is fixed, thanks, but I thought I would make it a little understandable to others.

Apache requires the php module to service php files. On Windows, it looks like a DLL file. This will be called: php5apache2_2.dll - located in your php folder. Strange, however, when updating the php folder with a newer version, you may find out that apache is still using the old php module file. Thus, while php -v correctly reports the new version, Apache is still looking at the old php module (reported by phpinfo). To find out which version of the module you have, you can: right-click on the .dll file> select properties → view the details tab. Or just hover over the file.

details screen of php5apache.dll file

If this version is not what you want, you may want to find a new version and replace it. A good idea for backup first. In addition, the php5apache.dll file works with the php5ts.dll file and requires it: so make sure that these files have the same version.

With your httpd.conf file with the directive:

 LoadModule php5_module "\path to\php5apache2_2.dll" 

You can restart apache and smile!

+5
source

Your command line version (CLI) is a different version than the one used for Apache. Check also that both use the same php.ini. When you call 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 

All of them can return different versions. Often this happens when upgrading to a new version of WAMP and forgetting to delete old versions. I am sure you will find the PHP executable binary that matches the same version. It is also useful to use php.exe or php-win.exe instead of php-cli.exe for Windows.

+1
source

Source: https://habr.com/ru/post/1339647/


All Articles