• 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

Adding multiple PHP version, got mod_fcgid: error reading data from FastCGI server

Polmonino

New Pleskian
I'm trying to add multiple PHP version (current version installed: 5.5.13), using the official documentation. I always get 500 Internal Server Error after switching to the new version, with the following error_log content:

Code:
[Sat Jun 07 00:49:35 2014] [warn] [client XXX.XXX.XXX.XXX] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server 
[Sat Jun 07 00:49:35 2014] [error] [client XXX.XXX.XXX.XXX] Premature end of script headers: index.php

Here you can view phpinfo() obtained running php54-cgi index.php from the command line. Same script doesn't work as FastCGI.

I'm trying to add PHP 5.4.29. Here is how I compiled it:

Code:
./configure \
--prefix=/usr/local/php54 \
--with-bz2 \
--with-config-file-path=/usr/local/php54/etc \
--with-config-file-scan-dir=/usr/local/php54/etc/php.d \
--with-curl \
--with-gd \
--with-gettext \
--with-iconv \
--with-layout=PHP \
--with-libxml-dir=/usr/local/php54 \
--with-mhash \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-openssl \
--with-pdo-mysql=mysqlnd \
--with-readline \
--with-xsl \
--with-zlib \
--enable-calendar \
--enable-cgi \
--enable-exif \
--enable-ftp \
--enable-intl \
--enable-mbstring \
--enable-pcntl \
--enable-shmop \
--enable-sockets \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--enable-zip

Code:
make && make install

Code:
cp php.ini-development /usr/local/php54/et/php.ini
/usr/local/psa/bin/php_handler --add -displayname 5.4.29 -path /usr/local/php54/bin/php-cgi -phpini /usr/local/php54/etc/php.ini -type fastcgi -id php54

Result:

Code:
Installing PHP CLI binary:        /usr/local/php54/bin/
Installing PHP CLI man page:      /usr/local/php54/php/man/man1/
Installing PHP CGI binary:        /usr/local/php54/bin/
Installing PHP CGI man page:      /usr/local/php54/php/man/man1/
Installing build environment:     /usr/local/php54/lib/php/build/
Installing header files:          /usr/local/php54/include/php/
Installing helper programs:       /usr/local/php54/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php54/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php54/lib/php/
[PEAR] Archive_Tar    - already installed: 1.3.11
[PEAR] Console_Getopt - already installed: 1.3.1
[PEAR] PEAR           - already installed: 1.9.4
Wrote PEAR system config file at: /usr/local/php54/etc/pear.conf
You may want to add: /usr/local/php54/lib/php to your php.ini include_path
[PEAR] Structures_Graph- already installed: 1.0.4
[PEAR] XML_Util       - already installed: 1.2.1
/usr/local/src/php-5.4.29/build/shtool install -c ext/phar/phar.phar /usr/local/php54/bin
ln -s -f /usr/local/php54/bin/phar.phar /usr/local/php54/bin/phar
Installing PDO headers:          /usr/local/php54/include/php/ext/pdo/

Switching back to PHP 5.5.13 and the script works fine (a simple phpinfo() output).

How can I try to understand/debug what's wrong with the installation?
 
Last edited:
Have you tried to search phrase "mod_fcgid: error reading data from FastCGI server" in KB articles? There are plenty related articles with different solutions...
 
Have you tried to search phrase "mod_fcgid: error reading data from FastCGI server" in KB articles? There are plenty related articles with different solutions...

I've found no solution for Plesk 12. And according to the docs, it should work out of the box without any workaround or "fix".

Any idea is much appreciated, thanks!
 
Any updates to this thread?
I followed those same instructions and, although it took hours to gather all the right dependencies, I was able to install 2 additional versions of PHP on a Centos 6.5/Plesk 12 system and they worked great. However, when I followed my same, meticulous instructions of everything I did on that server on a Centos 6.5/Plesk 11 system, I'm getting this exact error the OP has. I've searched and searched and haven't found a solution. If anyone knows what is causing this, please let us know.
 
I found my problem, I had the register_globals = YES in Plesk PHP parameters, which was causing the issue as it's not used valid directive for PHP5.4.

A fast procedure to figure this out and resolve the issue:
1) see in log file "/var/log/httpd/error_log" the following "PHP Fatal error: Directive 'register_globals' is no longer available in PHP in Unknown on line 0" after trying to execute the php page on the host using fastcgi
2) go to PLESK admin panel (11.5 for myself), click DOMAINS, then choose the domain using fastcgi.
3) click on General, then Personalize
4) click on PHP Parameters tab
5) go to line "register_globals", and MAKE SURE it's set to "DEFAULT" (which means the directive won't get written in the php.ini for a host using PHP 5.4)
Voilà!
 
Back
Top