Php Script Not Running

Home » CentOS » Php Script Not Running
CentOS 1 Comment

Hi All, I have CentOS 7. Apache and php are installed. CGI runs fine – php does not seem to run.

I have the /etc/httpd/conf.d/php.conf file php.conf
#
# Cause the PHP interpreter to handle files with a .php extension.
#

SetHandler application/x-httpd-php

#
# Allow php to handle Multiviews
#
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following lines to allow PHP to pretty-print .phps
# files as PHP source code:
#
#
# SetHandler application/x-httpd-php-source
#

#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler “files”
php_value session.save_path “/var/lib/php/session”

I have:
AddHandler cgi-script .cgi .php

The result is 500 internal server error.

everything seems like its setup – I have restarted httpd.

These are the PHP that are loaded:
rpm -qa | grep php php-common-5.4.16-45.el7.x86_64
php-5.4.16-45.el7.x86_64
php-fpm-5.4.16-45.el7.x86_64
php-cli-5.4.16-45.el7.x86_64

I do not see any reason in any of the httpd/log files just the 500 internal server error returned.

If I do the file with the PHP info line this displays correctly, but my other script does not run.

I have checked the permissions on the script and it is executable and owned by the same user my CGI programs are owned that work.

What might I be missing?

Jerry

One thought on - Php Script Not Running

  • PHP scripts are not passed to the “cgi-script” handler. They are passed to the “application/x-httpd-php”
    handler already configured in php.conf (provide by mod_php package). So, revert your changes (Delete:
    AddHandler cgi-script .cgi .php) and everything should run …

    PS: I assume that you run httpd/php via mod_php. This requires that the MPM is set to “prefork.c” (.+mpm.conf).