How to setup Multiple PHP versions on Apache using FastCGI Print

  • 0


Apache Webserver

Installing Multiple PHP

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

[[email protected] ~]# 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.

[[email protected] ~]# wget

After that, you should install it.

[[email protected] ~]# 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.

[[email protected] ~]# 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

[[email protected] ~]# wget

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

[[email protected] ~]# cd php-5.6.32

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

[[email protected] php-5.6.32]# ./buildconf --force

You should run your configure for all your PHP extensions.

[[email protected] 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.

[[email protected] php-5.6.32]# make
[[email protected] 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.

[[email protected] 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.

[[email protected] ~]# 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.

[[email protected] ~]# chown apache:apache /var/www/cgi-bin/php56.fcgi
[[email protected] ~]# 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