Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using Apache 2.2 + mod_fastcgi + PHP-FPM

My fastcgi.conf (Apache):

<IfModule mod_fastcgi.c>
    Action php-script /php5.fcgi virtual
    Alias /php5.fcgi /var/www/fcgi/php5.fcgi
    AddHandler php-script .php
    FastCGIExternalServer /var/www/fcgi/php5.fcgi -socket /var/run/php5-fpm.sock

    <Directory "/var/www/fcgi">
      Order allow,deny
      <Files "php5.fcgi">
        Order deny,allow

PHP scripts work fine, but I have a problem with some cases:

  • With a existent file request ( /image.jpg ). Return image. Works fine.
  • With a existent script request ( /index.php ). Process PHP. Works fine.
  • With a inexistent file request ( /ughehg.jpg ). Return custom 404. Works fine.
  • With a inexistent script request ( /hghugag.php ). Error. Don't show custom 404.

Browser show message "File not found." (with cgi.fix_pathinfo=0 on php.ini) or "No input file specified." (with cgi.fix_pathinfo=1 on php.ini).

My error.log:

FastCGI: server "/var/www/fcgi/php5.fcgi" stderr: Primary script unknown

What is the problem? How can I custom my 404 error for PHP scripts?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.