• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Plesk 11.5 Easy Install Script for Multiple PHP CentOS 6.4 x64

StéphanS

Regular Pleskian
This project is no longer maintained
I recommend switching to PHP Panda http://forum.parallels.com/showthread.php?293750-PHP-Panda!-Multi-PHP-installer-for-Plesk




The following script I made will automate these tasks:

- Install needed dependencies
- Download and extract sources
- Configure and make sources
- Install and register new PHP
- You will then be able to find the new PHP version in Plesk -> Domain -> Websites & Domains -> Web Hosting Access -> PHP -> FastCGI


Code:
yum -y install gcc make gcc-c++ cpp kernel-headers.x86_64 libxml2-devel openssl-devel bzip2-devel libjpeg-devel libpng-devel freetype-devel openldap-devel postgresql-devel aspell-devel net-snmp-devel libxslt-devel libc-client-devel libicu-devel gmp-devel curl-devel libmcrypt-devel unixODBC-devel pcre-devel sqlite-devel db4-devel enchant-devel libXpm-devel mysql-devel readline-devel libedit-devel recode-devel libtidy-devel

phpconfigureflagscommon="--with-libdir=lib64 --cache-file=./config.cache --prefix=/usr/local/php-\$phpversion-\$phptype --with-config-file-path=/usr/local/php-\$phpversion-\$phptype/etc --disable-debug --with-pic --disable-rpath  --with-bz2 --with-curl --with-freetype-dir=/usr/local/php-\$phpversion-\$phptype --with-png-dir=/usr/local/php-\$phpversion-\$phptype --enable-gd-native-ttf --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr/local/php-\$phpversion-\$phptype --with-openssl --with-pspell --with-pcre-regex --with-zlib --enable-exif --enable-ftp --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-wddx --with-kerberos --with-unixODBC=/usr --enable-shmop --enable-calendar --with-libxml-dir=/usr/local/php-\$phpversion-\$phptype --enable-pcntl --with-imap --with-imap-ssl --enable-mbstring --enable-mbregex --with-gd --enable-bcmath --with-xmlrpc --with-ldap --with-ldap-sasl --with-mysql=/usr --with-mysqli --with-snmp --enable-soap --with-xsl --enable-xmlreader --enable-xmlwriter --enable-pdo --with-pdo-mysql --with-pdo-pgsql --with-pear=/usr/local/php-\$phpversion-\$phptype/pear --with-mcrypt --without-pdo-sqlite --with-config-file-scan-dir=/usr/local/php-\$phpversion-\$phptype/php.d"

declare -A phpconfigureflagsspecific
phpconfigureflagsspecific[5.2.17-cgi]="--enable-fastcgi"
phpconfigureflagsspecific[5.3.27-cgi]="--without-sqlite3 --enable-intl"
phpconfigureflagsspecific[5.4.17-cgi]="--without-sqlite3 --enable-intl"
phpconfigureflagsspecific[5.5.1-cgi]="--without-sqlite3 --enable-intl"
phpconfigureflagsspecific[5.3.27-fpm]="--enable-fpm --without-sqlite3 --enable-intl"
phpconfigureflagsspecific[5.4.17-fpm]="--enable-fpm --without-sqlite3 --enable-intl"
phpconfigureflagsspecific[5.5.1-fpm]="--enable-fpm --without-sqlite3 --enable-intl"

declare -A phpdownloadurl
phpdownloadurl[5.2.17-cgi]="http://museum.php.net/php5/php-5.2.17.tar.gz"
phpdownloadurl[5.3.27-cgi]="http://be2.php.net/get/php-5.3.27.tar.gz/from/this/mirror"
phpdownloadurl[5.4.17-cgi]="http://be2.php.net/get/php-5.4.17.tar.gz/from/this/mirror"
phpdownloadurl[5.5.1-cgi]="http://be2.php.net/get/php-5.5.1.tar.gz/from/this/mirror"
phpdownloadurl[5.3.27-fpm]="${phpdownloadurl[5.3.27-cgi]}"
phpdownloadurl[5.4.17-fpm]="${phpdownloadurl[5.4.17-cgi]}"
phpdownloadurl[5.5.1-fpm]="${phpdownloadurl[5.5.1-cgi]}"

install_php () {
cd /usr/local/src/
phpversion=$1
phptype=$2
[[ -z "$2" ]] && echo "Usage: install_php phpversion phptype" && return 1

wget ${phpdownloadurl[$phpversion-$phptype]} -O /usr/local/src/php-$phpversion-$phptype.tar.gz
mkdir /usr/local/src/php-$phpversion-$phptype/
tar xzvf /usr/local/src/php-$phpversion-$phptype.tar.gz -C /usr/local/src/php-$phpversion-$phptype/ --strip 1
cd /usr/local/src/php-$phpversion-$phptype/
eval ./configure $phpconfigureflagscommon ${phpconfigureflagsspecific[$phpversion-$phptype]}

make -j $(grep processor /proc/cpuinfo | wc -l)
[ ! -d "/usr/local/php-$phpversion-$phptype/" ] && make install


# These ifs need a rewrite, CentOS 5.9 still ships PHP 5.2.10 as default and so /etc/php.ini will not work for PHP 5.3+ #
if [ "$phpversion" == "5.2.17" ]
then
cp /usr/local/src/php-$phpversion-$phptype/php.ini-recommended /usr/local/php-$phpversion-$phptype/etc/php.ini
sed -i "s#;date.timezone =#date.timezone = $timezone#" /usr/local/php-$phpversion-$phptype/etc/php.ini
else
cp -a /etc/php.ini /usr/local/php-$phpversion-$phptype/etc/php.ini
fi

[ "$phptype" == "cgi" ] && /usr/local/psa/bin/php_handler --add -displayname "$phpversion" -path "/usr/local/php-$phpversion-$phptype/bin/php-cgi" -phpini "/usr/local/php-$phpversion-$phptype/etc/php.ini" -type fastcgi -id "fastcgi-$phpversion"
[ "$phptype" == "fpm" ] && /usr/local/psa/bin/php_handler --add -displayname "$phpversion-$phptype" -path "/usr/local/php-$phpversion-$phptype/bin/php-cgi" -phpini "/usr/local/php-$phpversion-$phptype/etc/php.ini" -type fastcgi -id "fpm-$phpversion"

}


install_php 5.2.17 cgi
install_php 5.3.27 cgi
install_php 5.4.17 cgi
install_php 5.5.1 cgi


Note that this version of the script does NOT work with CentOS 5.9 (declare -A is not available in bash 3).
PHP 5.5.1 will also not compile on CentOS 5.9 because of old dependencies.



An updated guide and full PHP-FPM support will be made available on http://www.stone-is.com/en/blog/hos...-php-versions-for-plesk-115-centos-64-x64/29/

If enough requests make it, I will create an alternate version for CentOS 5.9
 
Last edited:
If enough requests make it, I will create an alternate version for CentOS 5.9

Hello Stephan,

Thanks for your great help.
Could you help me or guide me to use your instructions in a CentOS 5.9 i386 32 bits?

I'm stucked in the following line:

configure: error: Cannot find imap library (libc-client.a). Please check your IMAP installation.

Thank you in advance, great work.

Greetings.
 
Code:
yum -y install libc-client-devel
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * atomic: www5.atomicorp.com
 * epel: fedora-epel.mirror.lstn.net
Excluding Packages in global exclude list
Finished
Setting up Install Process
Package libc-client-devel-2004g-2.2.1.i386 already installed and latest version
Nothing to do
 
A follow up to this thread, we've put together PHP 5.3, 5.4, and 5.5 packages in our atomic-testing repo specifically to support the multiple PHP capabilities in Plesk 11.5. These are intended to live along-side of the existing vendor distributed PHP and not replace it. If anyone is interested in trying these out, just let me know here or in the atomic forums.
 
A follow up to this thread, we've put together PHP 5.3, 5.4, and 5.5 packages in our atomic-testing repo specifically to support the multiple PHP capabilities in Plesk 11.5. These are intended to live along-side of the existing vendor distributed PHP and not replace it. If anyone is interested in trying these out, just let me know here or in the atomic forums.

Please, post it here, I wish to try this.
 
A follow up to this thread, we've put together PHP 5.3, 5.4, and 5.5 packages in our atomic-testing repo specifically to support the multiple PHP capabilities in Plesk 11.5. These are intended to live along-side of the existing vendor distributed PHP and not replace it. If anyone is interested in trying these out, just let me know here or in the atomic forums.

Hello atomicturtle, I would like to test installing PHP 5.3 over a CentOS 5.9 32 bits using atomic-testing repo.
I installed PHP 5.4 using atomic repo, I'm using PHP 5.4.19

Thank you!
 
A follow up to this thread, we've put together PHP 5.3, 5.4, and 5.5 packages in our atomic-testing repo specifically to support the multiple PHP capabilities in Plesk 11.5. These are intended to live along-side of the existing vendor distributed PHP and not replace it. If anyone is interested in trying these out, just let me know here or in the atomic forums.

This is great! I am interested in testing.
 
Very nice to see that I sparked something here.
Thanks for stepping up and making it even simpler for Plesk admins, atomicturtle!


Send me a PM with the atomic-testing repo details please.
 
Last edited:
I am hoping on 5.2 support tho.
We are still having customers that rely on these old versions.
We can tell them to upgrade, but we can't force them.

I can compile my own versions, but a repo makes everyones life so much easier.
 
Very cool! Thank you! :praise:
I will give it a try to add version 5.5.x in next time.

What is if you want upgrade a version; Example 5.5.1 to 5.5.3? What is here to do?
 
Last edited:
PHP 5.2 is doable, we just need to backport (a lot!) security fixes into it, and that will take time. Right now I have the atomic php 5.3, 5.4 and 5.5 packages living alongside one another on a Plesk system using fcgi of cgi. As I mentioned earlier, these are independent of the DSO build. They are however built from the same standard PHP packages from atomic, so you have all the same sub modules available. That means that to upgrade to the next version of php, it would be just the regular old yum upgrade process.

Right now the EL6 (redhat/centos/cloudlinux) builds are done, and I'm working on the EL5 support for PHP 5.5 (lots of dependencies need to be sorted out, which takes time). So practically speaking, php5.3, 5.4 and 5.5 will all be merged into Atomic pretty soon, hopefully this week.
 
Update, the atomic-php55 packages for EL5 (redhat/centos/cloudlinux) were finished earlier today. This was the harder package to create, so PHP 5.4 should take much less time. Im considering rolling this under a single installer that would put all versions on the system (5.2/5.3/5.4/5/5), with support packages (mcrypt, mhash, pdo, etc) at same time. I'd be a big install, so I could use some feedback on what people are really looking for.
 
Hello fellas,

our manager install php 5.2 and 5.4 into CGI mode, but when when we change for anyone of this two version we lost access to mysql.
when i run info.php, appear that mysql is not installed.

a) how to have mysql in all of them?

b) Is better to add into fastCGI than just CGI?

thanks!
 
Back
Top