1

I have a site running PHP 5.2.17 (the PHP version is non-negotiable for various reasons, technical and policy) with fcgi. This version of PHP was installed through PHPFarm so that I could run other versions of PHP on different subdomains on this server.

Not every page in the site works, unfortunately. I'm getting the following Apache error for some of them:

End of script output before headers: php-cgi-5.2.17

You can see the phpinfo() file here for reference.

Here is the code for /etc/httpd/conf.d/x-pcit-le-ssl.conf:

 <VirtualHost *:443>

        ServerName pcit.extensiononline.ucdavis.edu

        DocumentRoot /var/www/vhosts/pcit

<Directory "/var/www/vhosts/pcit">
        Options +ExecCGI
        SSLOptions +StdEnvVars
        AddHandler fcgid-script  .php


Action php-cgi /php-fcgi/php-cgi-5.2.17


        <FilesMatch "\.php$">
                SetHandler php-cgi
        </FilesMatch>
</Directory>

RewriteEngine on

# Certificate info here #

ErrorLog /var/log/httpd/pcit.error.log

</VirtualHost>

And here is the code for /var/www/cgi-bin/php-cgi.5.2.17:

    #!/bin/sh
version="5.2.17"

PHPRC=/opt/phpfarm/inst/php-${version}/lib/php.ini
export PHPRC

PHP_FCGI_CHILDREN=3
export PHP_FCGI_CHILDREN

PHP_FCGI_MAX_REQUESTS=50000
export PHP_FCGI_MAX_REQUESTS

# which php-cgi binary to execute
exec /opt/phpfarm/inst/php-${version}/bin/php-cgi

suexec is installed. Here is the directory listing:

-rwsr-xr-x 1 root apache 14368 Jan 19 08:56 /usr/sbin/suexec*

The server is running Amazon Linux AMI, which I understand is similar to RH 7.

I've Googled and Googled for hours and my fingers are sore. I've found a few pages that deal with this issue, and they seem to indicate problems with fcgi, but I am not sure how to configure it properly. I've found the Apache page for mod_fcgid, but nothing there seems relevant.

I'm relatively new to this level of server administration, so any help anyone can offer would be more than appreciated. Thanks in advance.

  • 2
    Are you sure you don't have a bug in some of your PHP scripts? What makes you convinced this is an issue with the server, and not an issue with the code being run? – Zoredache Apr 20 '17 at 17:10
  • The code runs just fine on a different server where PHP is installed as a PHP Module. Of course, running PHP 5.2.17 as a module on the new server is not an option. – Richard Scott Crawford Apr 20 '17 at 17:22
  • Anything relevant/interesting in the Apache error log file (`/var/log/httpd/pcit.error.log`)? – Paul Haldane Apr 21 '17 at 08:12
  • Just the `End of script output before headers: php-cgi-5.2.17` error. – Richard Scott Crawford Apr 21 '17 at 15:49
  • What is the previous server's operating system? Have you actually compared the code with diff or used a VCS to compare the code on both servers? – jdog Apr 23 '17 at 21:55
  • The more I research this, the more convinced I am that it's an fcgid issue, so definitely not a server issue after all. Sorry for wasting everyone's time. – Richard Scott Crawford Apr 24 '17 at 19:38

0 Answers0