How to setup Multiple PHP versions on Apache using FastCGI Print

  • 330

Requirements:

Apache Webserver

Installing Multiple PHP

Before you begin with the process, you should install the epel release.

[root@dwhlinux ~]# yum install epel-release

Once it is done, you should download the installation package, which can be done with the help of the wget command.

[root@dwhlinux ~]# wget http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/x86_64/rpmforge/RPMS/mod_fastcgi-2.4.6-2.el6.rf.x86_64.rpm

After that, you should install it.

[root@dwhlinux ~]# rpm -Uvh mod_fastcgi-2.4.6-2.el6.rf.x86_64.rpm

And then, make sure you install all your required packages as follows. It is essential to have them installed before starting the installation of PHP.

[root@dwhlinux ~]# yum install gcc libxml2-devel libXpm-devel gmp-devel libicu-devel t1lib-devel aspell-devel openssl-devel bzip2-devel libcurl-devel libjpeg-devel libvpx-devel libpng-devel freetype-devel readline-devel libtidy-devel libxslt-devel libmcrypt-devel pcre-devel curl-devel mysql-devel ncurses-devel gettext-devel net-snmp-devel libevent-devel libtool-ltdl-devel libc-client-devel postgresql-devel bison gcc make -y

Once it is done, you shall install PHP from source and for that you should use wget command. First, let us install PHP 5.6

[root@dwhlinux ~]# wget http://in1.php.net/distributions/php-5.6.32.tar.gz

After it is done, you shall move inside the extracted directory by running the following command.

[root@dwhlinux ~]# cd php-5.6.32

In that directory, you should build your configuration with the help of the following command.

[root@dwhlinux php-5.6.32]# ./buildconf --force

You should run your configure for all your PHP extensions.

[root@dwhlinux php-5.6.32]# ./configure --prefix=/opt/php-5.6 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=apache --with-fpm-group=apache --with-libdir=lib64 --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-gd --with-jpeg-dir=/usr/lib/ --enable-fpm

Once it is done, you shall run the make and make install commands to build the installation process.

[root@dwhlinux php-5.6.32]# make
[root@dwhlinux php-5.6.32]# make install

Once it is done, you should copy the php.ini file from source location towards /opt/php-5.6/lib/ as follows.

[root@dwhlinux php-5.6.32]# cp /root/php-5.6.32/php.ini-production /opt/php-5.6/lib/php.ini

And then, you should create FastCGI script in the following location.

[root@dwhlinux ~]# vim /var/www/cgi-bin/php56.fcgi

Once it is done, you should provide appropriate permission for your fastcgi location. You can do that by running the following commands.

[root@dwhlinux ~]# chown apache:apache /var/www/cgi-bin/php56.fcgi
[root@dwhlinux ~]# chmod +x /var/www/cgi-bin/php56.fcgi

Now, we are done with the installation of PHP 5.6

 


Was this answer helpful?

« Back

Powered by WHMCompleteSolution