• 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

Two PHP versions linux Plesk HOWTO

This would be a very welcome addition to Plesk. PHP 5.5 is about to be released, making PHP 5.3 out of date. I have customers who want to use PHP 5.4, and I can't keep them all happy.

It would be even better if each customer could choose different PHP versions for different domains.
 
Last edited:
PHP Binaries in bin Folder are perfect ok! ;-)

Do you see any entry in "/var/log/httpd/suexec_log" when opening the Page where PHP 5.4 is active?
If so - please post them

Hi,

We're encountering the same issue here. We found the log below in the suexec_log.

2013-07-17 14:50:23]: uid: (10116/DOMAINUSER) gid: (507/507) cmd: .phpwrapper

Apache error log

[Wed Jul 17 13:59:40 2013] [error] [client 118.96.122.153] File does not exist: /var/www/vhosts/DOMAINNAME.com/httpdocs/favicon.ico
[Wed Jul 17 14:10:18 2013] [warn] [client 118.96.122.153] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed Jul 17 14:10:18 2013] [error] [client 118.96.122.153] Premature end of script headers: index.php

ll -a /var/www/vhosts/DOMAINNAME/
drwxr-xr-x. 21 root root 4096 Jul 15 22:45 .
drwxr-xr-x. 182 root root 12288 Jul 17 12:30 ..
drwxr-x---. 5 DOMAINUSER psaserv 4096 Jul 15 22:45 anon_ftp
drwxr-xr-x. 2 root root 4096 Jul 15 22:45 bin
drwxr-x---. 4 DOMAINUSER psaserv 4096 Jul 17 13:03 cgi-bin
drwxr-x---. 2 root psaserv 4096 Jul 17 14:28 conf
drwxr-xr-x. 2 root root 4096 Jul 15 22:45 dev
drwxr-xr-x. 2 root psaserv 4096 Jul 15 22:46 error_docs
drwxr-xr-x. 2 root root 4096 Jul 15 22:45 etc
drwxr-x---. 11 DOMAINUSER psaserv 4096 Jul 17 13:46 httpdocs
drwxr-x---. 7 DOMAINUSER psaserv 4096 Jul 15 22:46 httpsdocs
drwxr-xr-x. 2 root root 4096 Jul 15 22:45 lib
drwxr-xr-x. 2 root root 4096 Jul 15 22:45 lib64
drwxr-x---. 2 root psaserv 4096 Jul 17 13:43 pd
drwx------. 2 DOMAINUSER root 4096 Jul 15 22:46 private
dr-xr-x---. 7 root psaserv 4096 Jul 15 22:45 statistics
drwxr-xr-x. 2 root psaserv 4096 Jul 15 22:45 subdomains
drwxrwxrwt. 2 root root 4096 Jul 15 22:45 tmp
drwxr-xr-x. 4 root root 4096 Jul 15 22:45 usr
drwxr-xr-x. 3 root root 4096 Jul 15 22:45 var
drwxr-xr-x. 2 root psaserv 4096 Jul 15 22:45 web_users

ll -a /var/www/vhosts/DOMAINNAME/cgi-bin/
drwxr-x---. 4 DOMAINUSER psaserv 4096 Jul 17 13:03 .
drwxr-xr-x. 21 root root 4096 Jul 15 22:45 ..
d--x-----x. 2 DOMAINUSER psacln 4096 Jul 17 13:04 .cgi_wrapper
drwxr-xr-x. 2 DOMAINUSER psacln 4096 Oct 24 2012 test

ll -a /var/www/vhosts/DOMAINNAME/cgi-bin/.cgi_wrapper/
d--x-----x. 2 DOMAINUSER psacln 4096 Jul 17 13:04 .
drwxr-x---. 4 DOMAINUSER psaserv 4096 Jul 17 13:03 ..
-r-x------. 1 DOMAINUSER psacln 168 Jul 17 13:04 .phpwrapper

cat /var/www/vhosts/DOMAINNAME/cgi-bin/.cgi_wrapper/.phpwrapper
#!/bin/sh
export PHPRC=/var/www/vhosts/DOMAINNAME.com/etc/
export PHP_FCGI_CHILDREN=4
export PHP_FCGI_MAX_REQUESTS=1000
exec /usr/local/php52-cgi/bin/php-cgi

cat /var/www/vhosts/DOMAINNAME/conf/vhost.conf
<Directory /var/www/vhosts/DOMAINNAME.com/httpdocs>
RemoveHandler fcgid-script
<IfModule mod_fcgid.c>
AddHandler fcgid-script .php
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper /var/www/vhosts/DOMAINNAME.com/cgi-bin/.cgi_wrapper/.phpwrapper .php
Options +ExecCGI
allow from all
</Files>
</IfModule>
</Directory>

We have double checked everything (configuration,permission and ownership), they all look correct.

Please help...
 
Hello, some assistance here please.
on .phpwrapper i forgot to replace domain.com with my own.
ok i went back on this file in order to edit this line.

i have already gave the file permissions as the article instructed. But now i cannot gain access to this file. it's not editable, and i cannot chmod it for some reason.
-r-x------ 1 user psacln 155 Jul 8 14:14 .phpwrapper

chmod: changing permissions of `.phpwrapper': Operation not permitted

tried chmod 777 , u+x , a+x , tried to mv, or rm-rf but nothing worked.
any suggestions ?
 
Hi this tutorial was fine, I setup in my dedicated server, and It will work, but when access via "https", phpinfo show me old version, what is the problem with SSL. Best Regards.
 
Hi this tutorial was fine, I setup in my dedicated server, and It will work, but when access via "https", phpinfo show me old version, what is the problem with SSL. Best Regards.

You can get this to work with SSL by duplicating the vhost.conf file and calling it vhost_ssl.conf. The contents are the identical. This new file also goes in /var/www/vhosts/domain.com/conf
 
After command ./configure ..........

I got this problem:

loading cache ./config.cache
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for gcc... no
checking for cc... no
configure: error: no acceptable cc found in $PATH

Is that mean I have to install all these components? such as: gcc cc etc.?

Why the others don't have this problem? I use Debian 7 64 bit with Plesk 11.5

Please advise
 
Hi

My Current php version is 5.4.21
OS: CentOS6.4 64 bit
Plesk: 11.0.9 Update #60

Currently Installed php packages:-

php-ioncube-loader-4.4.1-3.el6.art.x86_64
php-mbstring-5.4.21-27.el6.art.x86_64
php-xmlrpc-5.4.21-27.el6.art.x86_64
php-pecl-apc-3.1.15-0.6.svn329913.el6.art.x86_64
php-cli-5.4.21-27.el6.art.x86_64
php-devel-5.4.21-27.el6.art.x86_64
php-mysql-5.4.21-27.el6.art.x86_64
php-pgsql-5.4.21-27.el6.art.x86_64
php-gd-5.4.21-27.el6.art.x86_64
php-xml-5.4.21-27.el6.art.x86_64
php-ldap-5.4.21-27.el6.art.x86_64
php-pear-1.9.4-4.el6.noarch
php-pecl-memcache-3.0.8-3.el6.art.x86_64
php-pdo-5.4.21-27.el6.art.x86_64
php-5.4.21-27.el6.art.x86_64
psa11-php-fakepackage-11.0.9-cos6.build110120608.16.x86_64
php-odbc-5.4.21-27.el6.art.x86_64
php-soap-5.4.21-27.el6.art.x86_64
php-imap-5.4.21-27.el6.art.x86_64
psa-php5-configurator-1.6.2-cos6.build110120608.16.x86_64

We have two old Joomla websites (1.5.x), which are not working with current php version. We need to install php 5.3. So downloaded the php 5.3.27 and is installed to "/usr/local/php53-cgi/". Following is the option used to configure:-

./configure '--with-libdir=lib64' '--cache-file=../config.cache' '--prefix=/usr/local/php53-cgi' '--with-config-file-path=/usr/local/php53-cgi/etc' '--disable-debug' '--with-pic' '--disable-rpath' '--enable-fastcgi' '--with-bz2' '--with-curl' '--with-freetype-dir=/usr/local/php53-cgi' '--with-png-dir=/usr/local/php53-cgi' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr/local/php53-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/php53-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-pear=/usr/local/php53-cgi/pear' '--enable-intl' '--without-pdo-sqlite' '--with-config-file-scan-dir=/usr/local/php53-cgi/php.d'



Followed the doc exactly. But i am getting the following error

[Thu Nov 14 09:47:52 2013] [warn] [client 59.96.242.110] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Thu Nov 14 09:47:52 2013] [error] [client 59.96.242.110] Premature end of script headers: a.php


# ls -al /var/www/vhosts/domain.com
total 56
drwxr-xr-x 14 root root 4096 Nov 14 07:05 .
drwxr-xr-x 69 root root 4096 Nov 14 09:45 ..
drwxr-x--- 5 bamburi psaserv 4096 Apr 5 2013 anon_ftp
drwxr-x--- 4 bamburi psaserv 4096 Nov 14 09:37 cgi-bin
drwxr-x--- 3 root psaserv 4096 Nov 14 11:13 conf
drwxr-xr-x 2 root psaserv 4096 Apr 5 2013 error_docs
drwxr-xr-x 2 root root 4096 Nov 14 07:05 etc
drwxr-x--- 23 bamburi psaserv 4096 Nov 14 08:57 httpdocs
drwxr-x--- 8 bamburi psaserv 4096 Apr 5 2013 httpsdocs
drwxr-x--- 2 root psaserv 4096 Nov 14 11:13 pd
drwx------ 2 bamburi root 4096 Apr 5 2013 private
dr-xr-x--- 7 root psaserv 4096 Apr 5 2013 statistics
drwxr-xr-x 2 root psaserv 4096 Apr 5 2013 subdomains
drwxr-xr-x 2 root psaserv 4096 Apr 5 2013 web_users



# ls -al /var/www/vhosts/domain.com/cgi-bin/
total 16
drwxr-x--- 4 bamburi psaserv 4096 Nov 14 09:37 .
drwxr-xr-x 14 root root 4096 Nov 14 07:05 ..
d--x-----x 2 bamburi psacln 4096 Nov 14 09:39 .cgi_wrapper
drwxr-xr-x 2 bamburi psacln 4096 May 10 2008 test


# ls -al /var/www/vhosts/domain.com/cgi-bin/.cgi_wrapper/
total 12
d--x-----x 2 bamburi psacln 4096 Nov 14 09:39 .
drwxr-x--- 4 bamburi psaserv 4096 Nov 14 09:37 ..
-r-x------ 1 bamburi psacln 158 Nov 14 09:39 .phpwrapper


cat /var/www/vhosts/domain.com/conf/vhost.conf
<Directory /var/www/vhosts/domain.com/httpdocs>
RemoveHandler fcgid-script
<IfModule mod_fcgid.c>
AddHandler fcgid-script .php
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper /var/www/vhosts/domain.com/cgi-bin/.cgi_wrapper/.phpwrapper .php
Options +ExecCGI
allow from all
</Files>
</IfModule>
</Directory>



Can anyone one point me what i am doing wrong?. I could be doing something so stupid.
 
My plesk version is 9.5.4. Can i still install two php versions(5.1.6 and 5.2.x) on the same plesk for linux server if my plesk version is 9.5.4?
 
script phpwrapper creator

If anyone needs to create several cgi wrappers you can use this script:

#!/bin/bash

phpwrapper="#!/bin/sh\n\
export PHPRC=/var/www/vhosts/domain.com/etc/\n\
export PHP_FCGI_CHILDREN=4\n\
export PHP_FCGI_MAX_REQUESTS=1000\n\
exec /usr/local/php5422-cgi/bin/php-cgi"

vhost_conf="<Directory /var/www/vhosts/domain.com/httpdocs>\n\
RemoveHandler fcgid-script\n\
<IfModule mod_fcgid.c>\n\
AddHandler fcgid-script .php\n\
<Files ~ (\.php)>\n\
SetHandler fcgid-script\n\
FCGIWrapper /var/www/vhosts/domain.com/cgi-bin/.cgi_wrapper/.phpwrapper .php\n\
Options +ExecCGI\n\
allow from all\n\
</Files>\n\
</IfModule>\n\
</Directory>"

#Adjust the query below to select the domains you want to create php wrapper
domains=$(mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e "select name from domains")
for domain in $domains;
do
if [ -e /var/www/vhosts/$domain/cgi-bin ]
then
echo "processing /var/www/vhosts/$domain/cgi-bin"
if [ -e /var/www/vhosts/$domain/conf/vhost.conf ]
then
echo "/var/www/vhosts/$domain/conf/vhost.conf EXISTS skipping"
continue
fi
mkdir /var/www/vhosts/$domain/cgi-bin/.cgi_wrapper
user=$(mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e "select login from sys_users where home like '%"$domain"'")
echo -e $phpwrapper | sed "s/domain.com/$domain/" > /var/www/vhosts/$domain/cgi-bin/.cgi_wrapper/.phpwrapper
chmod 101 /var/www/vhosts/$domain/cgi-bin/.cgi_wrapper
chmod 500 /var/www/vhosts/$domain/cgi-bin/.cgi_wrapper/.phpwrapper
chown $user:psacln /var/www/vhosts/$domain/cgi-bin/.cgi_wrapper -R
chattr -R +i /var/www/vhosts/$domain/cgi-bin/.cgi_wrapper
echo -e $vhost_conf | sed "s/domain.com/$domain/" > /var/www/vhosts/$domain/conf/vhost.conf
fi
done
 
What do you guys do about the php.d directory?
What do you populate it with?
I tried copying everything from /etc/php.d to /usr/local/php568-cgi/php.d but the new php complained loudly about those modules:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php568-cgi/lib/php/extensions/no-debug-non-zts-20131226/tidy.so' - /usr/local/php568-cgi/lib/php/extensions/no-debug-non-zts-20131226/tidy.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php568-cgi/lib/php/extensions/no-debug-non-zts-20131226/wddx.so' - /usr/local/php568-cgi/lib/php/extensions/no-debug-non-zts-20131226/wddx.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php568-cgi/lib/php/extensions/no-debug-non-zts-20131226/xmlreader.so' - /usr/local/php568-cgi/lib/php/extensions/no-debug-non-zts-20131226/xmlreader.so: cannot open shared object file: No such file or directory in Unknown on line 0


...etc..
 
Back
Top