• 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

My solution to running PHP4 (Module) and PHP5 (FastCGI) side by side

D

dericknwq

Guest
I have been browsing the forums here and I know many of you are hoping to setup PHP4 along with PHP5. You are not alone. Since I have got it working fine right now, I thought it will be good to share. :)

Thanks to this article at Media Temple, I got my quick and easy solution. I'm assuming that you guys are running Plesk 8.1 and have got PHP4 by default. Also, we wouldn't be having the latest and greatest PHP5 version this way but well, you can always compile your own (just more complicated). I am no expert so I am pretty happy with the results I've gotten now. So here we go, finally.

Since we are running PHP5 as FastCGI, you will need mod_fastcgi and PHP5 obviously. Thankfully, you can get this installed right from the Plesk Admin panel! The trick here is that, the SiteBuilder component will install PHP 5.1.4 along with it so that is why I said this is easy.

Go to Server >> Updater and check:
  • FastCGI support (mod_fcgid)
  • SiteBuilder and Sitebuilder module for Plesk
and now click INSTALL!

Once done, pick your choice of PHP5 setup from that article mentioned earlier.

I am personally taking the "Running PHP via suexec" approach but with minor differences which I'll highlight here.
The original vhost.conf as on the article:
Code:
AddHandler fcgid-script .php5
SuexecUserGroup <domain-user> psacln
<Directory /var/www/vhosts/<domain>/httpdocs>
     FCGIWrapper /var/www/vhosts/<domain>/bin/php5 .php5
     Options ExecCGI
     allow from all
</Directory>
My version:
Code:
# Removed since I prefer a per folder .htaccess approach
# AddHandler fcgid-script .php5

# This directive is in the default httpd.include so skip it
# SuexecUserGroup <domain-user> psacln
<Directory /var/www/vhosts/<domain>/httpdocs>
    FCGIWrapper /var/www/vhosts/<domain>/bin/php5 .php
    FCGIWrapper /var/www/vhosts/<domain>/bin/php5 .php5

    # These directives are in the default httpd.include so skip it
    # Options ExecCGI
    # allow from all
</Directory>
So that is left with just that two lines of FCGIWrapper directives.

Finally, you will just throw in this in your .htaccess at whichever folder you want PHP5 to be used instead.
Code:
# I want all .php and .php5 files to be PHP5-ed
AddHandler fcgid-script .php .php5
So now you can have PHP5 running happily where you want to! Additional reading at http://www.deanspot.org/~alex/php5fcgi/index.html will be useful for those who wish to compile their own PHP5 version. I guess this should be all and happy PHP-ing.
 
Hallo,
I have made the same config as you discribe, but when I want to run a php5 file, I got only a "500 Internal Server Error".

The /statistics/logs/error_log give me a "Premature end of script headers: info.php5"

The /var/log/apache2/suexec.log shows first "file has no execute permission: " but then I have made an 744 on the file and the logfile says "cmd: info.php5" and no errors.

I have tested the two versions from the article( with and without suexec) and dericknwq version, too.

There is everytime the same error :-(

Any ideas?
 
I also get an Internal Server error with the above recipe.

error_log produces:
[Mon May 28 02:43:31 2007] [notice] mod_fcgid: process /var/www/vhosts/beanywood.com/httpdocs/index.php(4339) exit(communication error), terminated by calling exit(), return code: 116


suexec_log seems to be just fine:
[2007-05-28 02:43:25]: uid: (10001/beanywoodcom) gid: (10001/10001) cmd: index.php
[2007-05-28 02:43:25]: directory is writable by others: (/var/www/vhosts/beanywood.com/httpdocs)


I'm very confused and would appreciate anyone's insight on this complicated issue.
 
I need to use php4 , my plesk 8.1 comes with php5

Hello my case is that my plesk 8.1 comes with php5 and i need to use php4 for several domains. How i do that, please help. I read that plesk 8.1 comes with an option to choose betwwen php4 and php5 for a specific domain.

Tanks in regards
 
I also get the 500 internal server error.

How do you fix this ? The tech support drones @ 1and1 aren't exactly supportive or helpful :)
 
Hi

any solution to the internal 500 server error available?
Code:
20 17:59:08 2007] [notice] mod_fcgid: process /var/www/vhosts/XXX/httpdocs/phpinfo.php(17992) exit(server exited), terminated by calling exit(), return code: 0
[Tue Nov 20 17:59:08 2007] [notice] mod_fcgid: process /var/www/vhosts/XXX/httpdocs/phpinfo.php(17991) exit(server exited), terminated by calling e

my suexec.log shows that
Code:
20 17:58:54]: uid: (10001/test) gid: (2524/2524) cmd: php5
[2007-11-20 17:58:55]: uid: (10001/test) gid: (2524/2524) cmd: php5

THX for help and best regards
ACID25
 
Back
Top