📜 ⬆️ ⬇️

Adding PHP 5.2 support to XAMPP

XAMPP is a bunch of PHP-Apache-MySQL, as well as Perl, ProFTPd, phpMyAdmin and many more in one ready-made bundle. It has its pluses and minuses, and I want to share information on correcting one of these shortcomings in this post.
The "disadvantage" is that developers are trying to include in the pack rather fresh, non-stable versions of software, which sometimes are not yet supported by third-party extensions. For me, PHP 5.3, which is present in XAMPP from version 1.7.2, and Zend Optimizer, which is not yet available for PHP 5.3 (although it was promised a long time ago), became a stumbling block.

Logic and Google prompted two solutions to the problem - downgrade the entire XAMPP to version 1.7.1 or downgrade PHP to 5.2. I found the second option more preferable, since it left more recent versions of the rest of the software, and it seemed less troublesome. The original solution vector was found on stackoverflow and added on its own to enable switching from PHP 5.3 to 5.2 and back.


Decision


I have compiled a small archive containing everything needed to cross two versions of PHP in XAMPP 1.7.3a and modified scripts to switch versions.
Download archive (Yandex.Disk)
The installation is reduced to a simple unpacking of the archive on top of your XAMPP installation and restarting the web server. The function of switching between versions is highlighted in a separate part and lies in the folder of the contrib archive. There are already modified files and a patch for those who have already modified the standard scripts for their needs.
')

DIY or general instructions for other versions


... as well as for those who are just wondering how it works.
The solution is based on a mechanism that served in XAMPP 1.6. * For switching PHP4 and PHP5 and is still unclaimed.
Step by Step:
  1. See the PHP version in our installation. Below I will assume that it is equal to 5.3.1.
  2. Downloading XAMPP 1.7.1 - this is the latest version, which was PHP 5.2
  3. From the downloaded archive, copy the files lampp / bin / php * 5.2.9 to / opt / lampp / bin /
  4. In the same folder, all symlinks pointing to php * 5.3.1 files are redirected to the corresponding files of version 5.2.9.
  5. The file /opt/lampp/modules/libphp5.so is renamed to libphp5.so-5.3.1
  6. Again from the archive, copy the file lampp / modules / linphp5.so to the file /opt/lampp/modules/libphp5.so-5.2.9
  7. Create a libphp5.so symlink at libphp5.so-5.2.9
  8. At this stage, you can already restart the web server and use the PHP 5.2.9 version, but we will go further and arrange the version switch.
  9. Open the file / opt / lampp / share / lampp / activatephp
  10. We find lines in it
    1. ln -s phpextdist { - $VERSION , } ln -s php-config { - $VERSION , }
    2. ln -s phpextdist { - $VERSION , } ln -s php-config { - $VERSION , }
  11. After them we add
    1. cd / opt / lampp / modules
    2. rm libphp5.so 2 > / dev / null
    3. ln -s libphp5.so { - $ VERSION , }
  12. Open the file / opt / lampp / lampp
  13. Find the lines
    1. "php5" )
    2. / opt / lampp / share / lampp / activatephp 5.3.1
    3. ;;
  14. After add
    1. "php5.2" )
    2. / opt / lampp / share / lampp / activatephp 5.2.9
    3. ;;


Everything! Now we can type / opt / lampp / lampp php5.2 in the console and check phpinfo ().

Well, a couple of comments at the end. Firstly, in the process of googling, I met the mention that people managed to slip even more recent versions of PHP 5.2 than those that were in XAMPP a year ago, taking them from the distribution repository. I did not check the authenticity of the irrelevance for me, and I doubt that this is correct, since the search paths for settings and extensions in XAMPP are different.
Secondly, you can try to build the necessary version yourself, using the Development Package from the XAMPP website and PHP source files .

PS I leave aside the advantages and disadvantages of XAMPP compared to manually installing the LAMP bundle from the repository - here everyone chooses from their own needs and preferences.
PPS I doubt which blog to put in, so far put in PHP.

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


All Articles