Installation of two versions of php (5.2 and 5.3) on a server with Centos and panel ISPmanager

Thursday, 22 January 2015 00:40

PHP version 5.2, though, and already seems to have outlived its function, but still more is needed. After all, there are more old sites that will not work on newer versions of php. For example those that are encoded by Zend 5.2, and they are not alone.

We have: server OS Centos on board, ISPmanager control panel and set the standard method php 5.3.x.

Task: installed on the server and more php 5.2, and implement convenient switching between versions for each site.

The basic version of php we will be the 5.3, as can be updated without any problems, etc., but more will be version 5.2, since its development is completed.

The bottom line is that we will install php 5.2 as CGI, and 5.3 we will work as a module apache.

Downloading the latest version of php 5.2 and unpack:

cd /tmp
wget http://get.webpatron.net/php/php-5.2.17.tar.gz
tar xzvf php-5.2.17.tar.gz
cd php-5.2.17

Immediately put the packages that we need to not come across errors in the assembly:

yum install libxml2-devel bzip2-devel curl-devel libjpeg-devel libpng-devel libX11-devel gd-devel libc-client-devel libmcrypt-devel mysql-devel

Preparing source php to build:

./configure --prefix=/opt/php52 \
--with-config-file-path=/opt/php52/etc \
--with-config-file-scan-dir=/opt/php52/etc/php.d \
--with-libdir=lib64 \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--with-curl \
--with-gd \
--with-bz2 \
--with-iconv \
--with-imap \
--with-gettext \
--with-pic \
--with-bz2 \
--with-iconv \
--with-zlib \
--with-jpeg-dir \
--with-png-dir \
--with-kerberos \
--with-imap-ssl \
--enable-cli \
--enable-pdo \
--enable-exif \
--enable-ftp \
--enable-magic-quotes \
--enable-fastcgi \
--enable-discard-path \
--enable-bcmath \
--enable-calendar \
--enable-gd-native-ttf \
--enable-libxml \
--enable-mbstring \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-xml \
--enable-wddx \
--enable-zend-multibyte \
--enable-zip \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-force-cgi-redirect

Compile and then set:

make
make install

Now fasten our php 5.2 to the panel ISPmanager. To do this, we'll remove php-cgi binary from php 5.3, and instead rely on our 5.2.

rm /usr/bin/php-cgi
ln -s /opt/php52/bin/php-cgi /usr/bin/php-cgi

At this, in principle, everything. Now, if the properties of the domain www choose php module apache, it will be version 5.3. And if you choose php as a CGI, it will just set us 5.2.

You can make more beautiful, not to forget and not get confused. Write a small plugin for ISPmanager panel to select the version of PHP.

Go to the folder /usr/local/ispmgr/etc and create there a file named ispmgr_mod_changerphp.xml

As we enter the following file:

<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
<lang name="ru">
<messages name="wwwdomain.edit">
<msg name="cgi">Cgi-bin</msg>
<msg name="charset">Encoding (optional)</msg>
<msg name="hint_php">This option specifies the version of PHP</msg>
<msg name="index">The index page. (Optional)</msg>
<msg name="php">Configuring PHP</msg>
<msg name="phpcgi">PHP v5.2.17 (outdated)</msg>
<msg name="phpfcgi">PHP as FastCGI</msg>
<msg name="phpmod">PHP v5.3.28 (recommended)</msg>
<msg name="phpnone">No support for PHP</msg>
</messages>
</lang>
</mgrdata>

Then restart the command bar:

killall -9 ispmgr

Now, with the result that we have. What was our goal - to make a simple choice php version for each site.

isp4php

Now it is necessary to set up our php 5.2. To run the / opt / php52 / etc folder create more php.d and already in it, create a file php.ini, which prescribes the necessary and global settings. Here you can tie and the right version of zend optimizer, and everything else. Also, each user on the server using php 5.2 and has its own php.ini, where you can also make settings for a specific user.


Leave a comment

  • Payment
    Methods:
  • visa
  • mastercard
  • qiwi
  • webmoney
  • yandex money
  • sberbank
  • mts bank
  • zpayment
  • liqpay
  • alfabank white
Copyright © 2012 - 2019 WebPatron Ltd. All rights reserved.