Igor Smitran
New Pleskian
Few days ago i was exchanging emails with Parallels support. I was asking them to help me to setup two php versions on linux plesk server. After few emails they answeared me that it is not possible. It didn't help when i told them that i was using fastcgi on my own hosting server and that i was having 3 php versions configurable per customer. Nop... Their answear was
So, i logged in to Plesk server and spend around 20 minutes planning how to intercept Plesk calls. And it is done.
For this to work you have to have php running as fastcgi (it is most secure way, so i assume that everyone is running php as fastcgi)
Here it goes:
1. ssh to your plesk server, download php source, unpack it and configure it
NOTICE: you HAVE TO USE PREFIX switch in order to have your new php installed inside one directory, for example:
As you can see, my prefix was /usr/local/php540-cgi/
Choosing a prefix is a MUST because that way your new php installation will not interfere with older php used by plesk.
2. compile your php
3. install your new php
4. create php wrapper
for example, let's say that you have a customer blabla.com that uses some newer php functions that don't exist in php 5.1. Let's call that customer blabla.com. For him we will tell apache to use our new php (5.4.0)
now we will create new file and name it .phpwrapper
file content:
let's strengthen our new files and dirs permissions and privileges:
And, there i was, left helpless, without possibility to finish migration from my old hosting server to our new and shiny Plesk. I needed newer php version because php provided by my linux distro is 5.1.As of now there is no option available in the linux, where you can choose php as per the customers.
Hope you are clear now. If you have any further help, feel free to get back to us. We would be glad to assist you further.
So, i logged in to Plesk server and spend around 20 minutes planning how to intercept Plesk calls. And it is done.
For this to work you have to have php running as fastcgi (it is most secure way, so i assume that everyone is running php as fastcgi)
Here it goes:
1. ssh to your plesk server, download php source, unpack it and configure it
Code:
ssh yourserver -l root
cd /usr/local/src
mkdir php540
cd php540
wget http://www.php.net/get/php-5.4.0.tar.gz/from/at2.php.net/mirror
tar xzvf php-5.4.0.tar.gz
cd php-5.4.0
NOTICE: you HAVE TO USE PREFIX switch in order to have your new php installed inside one directory, for example:
Code:
./configure '--with-libdir=lib64' '--cache-file=../config.cache' '--prefix=/usr/local/php540-cgi' '--with-config-file-path=/usr/local/php540-cgi/etc' '--disable-debug' '--with-pic' '--disable-rpath' '--with-bz2' '--with-curl' '--with-freetype-dir=/usr/local/php540-cgi' '--with-png-dir=/usr/local/php540-cgi' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr/local/php540-cgi' '--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' '--without-sqlite3' '--with-libxml-dir=/usr/local/php540-cgi' '--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/php540-cgi/pear' '--with-mcrypt' '--enable-intl' '--without-pdo-sqlite'
Choosing a prefix is a MUST because that way your new php installation will not interfere with older php used by plesk.
2. compile your php
Code:
make
3. install your new php
Code:
make install
4. create php wrapper
for example, let's say that you have a customer blabla.com that uses some newer php functions that don't exist in php 5.1. Let's call that customer blabla.com. For him we will tell apache to use our new php (5.4.0)
Code:
cd /var/www/vhosts/blabla.com/cgi-bin
mkdir .cgi_wrapper
cd .cgi_wrapper
now we will create new file and name it .phpwrapper
Code:
vi .phpwrapper
file content:
Code:
#!/bin/sh
export PHPRC=/var/www/vhosts/blabla.com/etc/
export PHP_FCGI_CHILDREN=4
export PHP_FCGI_MAX_REQUESTS=1000
exec /usr/local/php540-cgi/bin/php-cgi
let's strengthen our new files and dirs permissions and privileges:
Code:
cd /var/www/vhosts/blabla.com/cgi-bin
chmod 101 .cgi_wrapper
chmod 500 .cgi_wrapper/.phpwrapper
chown blabla.com:psacln .cgi_wrapper -R
chattr -R +i .cgiwrapper