When trying custom htaccess I get proxy_fcgi:error AH01071: Got error 'Primary script unknown'

mik3ca

New member
Joined
May 31, 2026
Messages
7
I have a big problem.
Everytime I try to access my php file through mod_rewrite rules, I don't get the expected result, and apache error_log reports:

Code:
[Tue Jun 09 02:15:24.855786 2026] [proxy_fcgi:error] [pid 5122:tid 5580] [remote ip-addr:port] AH01071: Got error 'Primary script unknown'

In the past I had cPanel and apache installed with PHP as an integrated module to apache (no PHP-FPM).
Now it seems like apache wants to go through some proxy and CGI to call php scripts.

Is there away through directadmin to do away with PHP-FPM and go back to the integrated module? I believe the module name is libphp.so and php would compile this at installation time. Then it would help me do away with proxy.
 
Hello,

I believe you might better update your mod_rewrite rules. You might even share them here and probably other users will help you to modify them.
 
I attempted some troubleshooting and still get the same result. What I did was make a brand new web directory set user and group to match those in SuexecUserGroup in my virtual hosts as follows:

Code:
mkdir /web
echo '<?php phpinfo(); ?>' > /web/a.php
echo 'a' > /web/a.htm
chown admin:admin -R /web
chown admin:admin /web/a.php
chown admin:admin /web/a.htm

Then I updated /usr/local/directadmin/custombuild/custom/ap2/conf/extra/httpd-vhosts.conf to the following minus comments:

Code:
Include /etc/httpd/conf/ips.conf

<VirtualHost |IP|:|PORT_80||LINKEDIP|>
    AddHandler "proxy:unix:/run/php-fpm/php82-1004.sock|fcgi://localhost" .inc .php .phtml
    ServerAdmin webmaster@localhost
    DocumentRoot /web
    ServerName |IP|
    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    CustomLog /var/log/httpd/access_log combined
    ErrorLog /var/log/httpd/error_log
    SuexecUserGroup admin admin
</VirtualHost>

<VirtualHost |IP|:|PORT_443||LINKEDIPSSL|>
    AddHandler "proxy:unix:/run/php-fpm/php82-1004.sock|fcgi://localhost" .inc .php .phtml
    ServerAdmin webmaster@localhost
    DocumentRoot /ccweb/clubcatcher.com
    ServerName |IP|
    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    CustomLog /var/log/httpd/access_log combined
    ErrorLog /var/log/httpd/error_log
    SSLEngine on
    SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt.combined
    SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
    SuexecUserGroup admin admin
</VirtualHost>

Then I confirmed this file exists: /run/php-fpm/php82-1004.sock with:
Code:
ls /run/php-fpm/php82-1004.sock

Then to save the changes I executed:
Code:
da build rewrite_confs

and for good measure, to make sure the server is up....
Code:
httpd -k restart

I attempt to access the following URLS where ipaddr is the public server IP address:
Code:
http://ipaddr/a.htm
https://ipaddr/a.htm
http://ipaddr/a.php
https://ipaddr/a.php

The first two URLs return the expected result of 'a' (the contents of a.htm)
But the second two URLs return the same issue. The HTTP code to the browser is 404 and the same error being logged is what's in the title.

So I ruled out my custom script to my website is NOT the issue.

How do I fix this.
 
Back
Top