What does AH01071: Got error 'Primary script unknown\n error means?

rtdirect

New member
Joined
Oct 2, 2018
Messages
5
I got this error on apache logs:

Code:
[Mon Oct 01 21:56:45.* 2018***] [proxy_fcgi:error] [pid 145*:*tid 14****] [client ****] AH01071: Got error 'Primary script unknown\n'
[Mon Oct 01 21:56:4*** 2018] [proxy_fcgi:error] [pid 14535:tid 140****] [client *****] AH01071: Got error 'Primary script unknown\n'
[Mon Oct 01 21:56:45.916027 2018] [proxy_fcgi:error] [pid 145***:tid 140*****] [client *****] AH01071: Got error 'Primary script unknown\n'
[Mon Oct 01 21:56:46****2018] [proxy_fcgi:error] [pid 145***:tid 140*****2] [client ****] AH01071: Got error 'Primary script unknown\n'
[Mon Oct 01 21:56:4*** 2018] [proxy_fcgi:error] [pid 145**:tid 1401*****] [client ****] AH01071: Got error 'Primary script unknown\n'
[Mon Oct 01 21:56:47*2018] [**proxy_fcgi:error] [pid 14***:tid 140*****] [client ****] AH01071: Got error 'Primary script unknown\n'
[Mon Oct 01 21:56:4* 2018] ***[proxy_fcgi:error] [pid 145***:tid 1401***] [client ********] AH01071: Got error 'Primary script unknown\n'

Why im getting this error?
How to fix?
 
I guess that means the php file does not exist (404), primary with bots/etc trying to find vulnerable scripts, but the htaccess is wrong.

See here
 
@rtdirect,

I guess you need to check the link in the post #2 suggested by Peter, and you will probably understand what has it to do with .htaccess.
 
@rtdirect,

I guess you need to check the link in the post #2 suggested by Peter, and you will probably understand what has it to do with .htaccess.

my htaccess code not like that.
there is no /fc2/ on me.
 
Try
Code:
RewriteBase /

i appreciate with your help but my htaccess is similar to wordpress default htaccess.

Like this:

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

There are also some plugin added codes in it.
 
I'm actually seeing this myself without even realising :(

No error pages appear to the browser, just a "File not found" appears for .php pages.......

Looks like it's a deeper problem than I first thought.

Erm.... Apache and php-fpm.
 
I have just noticed the same thing (never did before, no real reason to check for 404s errors :) )

I also found the solutions for both Nginx and Nginx+Apache
If you're using only Nginx and php-fpm use this when you're calling the PHP handler:
Code:
fastcgi_intercept_errors on;
(https://serverfault.com/questions/628810/serve-a-custom-404-page-generated-by-php)

If you're using Nginx+Apache (or only Apache) and php-fpm use this when you're calling the PHP handler:
Code:
ProxyErrorOverride on
(https://stackoverflow.com/questions/33843786/custom-404-message-when-using-php-fpm-with-apache=

Quick example for Apache:
Code:
                        ProxyErrorOverride on
                        AddHandler "proxy:unix:/usr/local/php56/sockets/cn.sock|fcgi://localhost" .php56

I think is more likely to be better to change the templates using custom versions, but probably much better if DA add this option as default.

I am going to forward the URL to this thread to John.

PLEASE NOTE: Enabling this option might disable the per-site custom error pages (as for instance the one generated by WP) in Nginx (it does NOT in Apache, I tested, but Apache uses .htaccess to override this, on Nginx there is no .htaccess so I am not sure how the custom error pages in WP do works and if this might cause an issue.
In Nginx I presum Custom HTTPD Templates will be used, so it still might be fine actually.

Regards
 
Last edited:
A fix for Apache has been addded, now in pre-release: https://www.directadmin.com/features.php?id=2211
For Nginx has not yet been implemented because John wasn't able to replicate (as for Apache, but since there were 3 ppl having this issue did just make sense to fix it)

You write "a fix for Apache", but the feature page says "nginx+apache", I sure hope it is not added for plain Apache.

I don't know about Nginx and Nginx+Apache, but you must not add "ProxyErrorOverride on" for plain Apache, that will break Drupal "Maintenance Mode page", because Drupal is actually sending a HTTP status 503 for their Maintenance Mode page. It is also likely that this will cause trouble for other CMS.
 
Apache doesn't care if it's the only webserver, the fix is on the check for PHP-FPM, regardless of Nginx, that's why is a fix for Apache, it would work on any Apache related configuration when using PHP-FPM.

Wouldn't Drupal use a .htaccess file to override the error pages?
 
All I am saying is that DirectAdmin should not add "ProxyErrorOverride on" to /etc/httpd/conf/extra/httpd-default.conf for us that use plain Apache (I don't know about Nginx and don't use it). I have tested this because DirectAdmin added "ProxyErrorOverride on" in the beginning of march 2018, and I got support tickets from customers complaining that Drupal maintainance page did not work any more. I sent a ticket to DirectAdmin wich reverted this change in CustomBuild 2.0 rev. 1846. I have now sent a new ticket to DirectAdmin to let them know about this again.

Regarding Drupal and their "Maintenance Mode page", this thread might give some information about that: https://www.drupal.org/project/drupal/issues/2674900 (please note Drupal is not going to change this, because the status says "Closed (works as designed)".
 
I see your point, but that's not where has been added actually

Code:
Relates to not passing errors to nginx, and instead let php/apache generate the error pages.
The 4 virtual_host2*.conf files will have:
ProxyErrorOverride on

just before the AddHandler for both php1-fpm and php2-fpm.

I will check that Drupal report, do you have by any chance a test server where Drupal is configured and I can run some confs tests so to find a better solution if this doesn't work?
 
Drupal is actually responding with a 503 which is an HTTP Server code, so I don't see the problem on using the HTTP Server to handle them.

Then, if you want to have a custom page that says "Mantainance mode on" that's up to the customer and can (and should) be managed by .htaccess.

I don't see nor understand how PHP would handle that better, I would need an example
 
I found some example to have custom 503 Page on Drupal and not the server one (which I repeat, are the correct one to be showed for every normal case), sites have been using standard web server error page for ages, I don't see how Drupal can have a "say" on that :)

https://groups.drupal.org/node/256708

https://gist.github.com/perusio/3778833

Custom code for the Nginx config:
Code:
error_page 503 = @503;

location @503 {
     if ($upstream_http_etag) {
         return 503 "Site down for maintenance. We'll be back shortly";
     }
}

Best regards
 
@SeLLeRoNe, Well this is how Drupal handle Maintenance page, and we are a shared hosting and we need to support Drupal out of the box. The Drupal Maintenance page does not work when "ProxyErrorOverride on" is added, but instead show the default Apache 503 status page. As a shared host, we can't tell customers to use different solutions, we need to support Drupal out of the box.

Again I ask that "ProxyErrorOverride on" is not added for us that use plain Apache. If it is added by DirectAdmin, we will remove it manually on every update. I am not going into a debate on this. I have said all I have to say.
 
Is not matter of Apache or Nginx+Apache, that is not what is causing the problem, the problem is Apache+PHP-FPM and Nginx+PHP-FPM and Nginx+Aoache+PHP-FPM.

If you use Apache+MOD_PHP you would have the error pages handled by Apache aswell, even in that case you wouldn't use the Drupal one unless you have custom .htaccess or customizations in Apache configuration.

That option is used when you are using a Proxy after Apache (as PHP-FPM work).
If Drupal is working as stand-alone application it would means you're proxying it, so you wouldn't put that option on that proxy coniguraiton, while DA is adding that for the specific AddHandler bit when PHP-FPM is in place, not as a default option.

Here an example of configuration from last update from my server:
Code:
                <FilesMatch "\.(inc|php|phtml|phps|php72)$">
                        ProxyErrorOverride on
                        AddHandler "proxy:unix:/usr/local/php72/sockets/cn.sock|fcgi://localhost" .inc .php .phtml .php72
                </FilesMatch>
                <FilesMatch "\.(inc|php|phtml|phps|php56)$">
                        ProxyErrorOverride on
                        AddHandler "proxy:unix:/usr/local/php56/sockets/cn.sock|fcgi://localhost" .php56
                </FilesMatch>

If you're bypassing somehow PHP-FPM for Drupal (not sure, never used Drupal so mine are just hypotesis), than you should be fine.
If Drupal is working as any other PHP Application, which is run from PHP (either mod_php or PHP-FPM) than the result shouldn't change with that option.

Again, the change is not in the default template as you wrote, so that shouldn't even affect you.

Best regards
 
Back
Top