Got error ‘Primary script unknown’ after update PHP-FPM + Apache 2.4

After a update_versions in DirectAdmin I got this error on a sites error log:

[client 1.2.3.4:62903] AH01071: Got error 'Primary script unknown\n'

The URL it self gave:

File not found.

Yesterday everything was working fine. After updating Apache 2.4.x and PHP-FPM (5.6) I figured it had to do something with those services.

But the app (CodeEgniter) was running in a subfolder. The main folder contained a WordPress install and was working fine.

So after some time I tried to play with the .htaccess file, and I succeeded. I changed this old .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteBase /fc2/

To this new variation:

RewriteBase /fc2/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /fc2/index.php [L]

Don’t ask me why, but the Primary script unknown is gone.

So in this case it had nothing to do with ProxyHandler, ProxyPass or other configuration issues between PHP-FPM and Apache. Just a little .htaccess error which results in a bug.

Published by

Maarten Keizer

Hosting guru. WordPress addict. n00b programmer.

3 thoughts on “Got error ‘Primary script unknown’ after update PHP-FPM + Apache 2.4”

  1. I dont get it !
    It worked for me too, I had the bug after a stack change and using a SetHandler for calling FPM from Apache.

    The non working Line is this
    #RewriteRule ^(.*)$ index.php/$1 [L]

    The working one is this
    RewriteRule . /index.php [L]

Leave a Reply

Your email address will not be published. Required fields are marked *