php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79014 PHP-FPM & Primary script unknown | no more PHP Render
Submitted: 2019-12-21 21:21 UTC Modified: 2020-03-01 18:15 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: sainthyoga2003 at gmail dot com Assigned: bukka (profile)
Status: Closed Package: FPM related
PHP Version: 7.4.0 OS: openSUSE Tumbleweed
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sainthyoga2003 at gmail dot com
New email:
PHP Version: OS:

 

 [2019-12-21 21:21 UTC] sainthyoga2003 at gmail dot com
Description:
------------
Actually I don't know if is related to Apache2 or to FPM. 

All was running ok with PHP 7.3.11. This happened once I updated PHP to 7.4.0

If I try to run phpinfo from localhost: http://localhost/index.php I get a blank page. Now if I try to run ANY other script from the web, I get the error 'Primary script unknown'.

 



Test script:
---------------
<?php
phpinfo();

Expected result:
----------------
Web page with my PHP information. Via CLI it works.

Actual result:
--------------
Blank page for localhost/index.php

File not found for localhost/whatever/whatever.php, localhost/whatever.php

Error loged as Primary script unknown

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-12-21 21:26 UTC] sainthyoga2003 at gmail dot com
-PHP Version: 7.4.1 +PHP Version: 7.4.0
 [2019-12-21 21:26 UTC] sainthyoga2003 at gmail dot com
Fix PHP Version.
 [2019-12-21 21:30 UTC] requinix@php.net
-Status: Open +Status: Feedback -Package: Apache2 related +Package: *General Issues
 [2019-12-21 21:30 UTC] requinix@php.net
Your Apache configuration is not set up properly for FastCGI. Specifically, it is not passing the PATH_TRANSLATED CGI variable. May be missing others too.
 [2019-12-21 22:03 UTC] sainthyoga2003 at gmail dot com
I don't think so. If the previous version was working, why should fail when upgrade?

My current php7 handler for apache is:

<IfModule mod_php7.c>
       <FilesMatch "\.ph(p[345]?|tml)$">
           SetHandler application/x-httpd-php
       </FilesMatch>
       <FilesMatch "\.php[345]?s$">
           SetHandler application/x-httpd-php-source
       </FilesMatch>
        #DirectoryIndex index.php4
        #DirectoryIndex index.php5
        DirectoryIndex index.php
</IfModule>
<IfModule mod_proxy_fcgi.c>
       <FilesMatch "\.ph(p[345]?|tml)$">
           SetHandler "proxy:unix:/var/run/php-fpm.sock|fcgi://localhost/"
       </FilesMatch>
       <FilesMatch "\.php[345]?s$">
           SetHandler application/x-httpd-php-source
       </FilesMatch>
        DirectoryIndex index.php
        #DirectoryIndex index.php4
        #DirectoryIndex index.php5
</IfModule>

I have just made a rollback to get the PHP 7.3.11 what is working.
 [2019-12-23 10:43 UTC] cmb@php.net
-Status: Feedback +Status: Open
 [2019-12-23 10:43 UTC] cmb@php.net
Feedback has been given.
 [2020-01-02 11:13 UTC] counterstrikec4 at gmail dot com
I also show this bug when using the following bundle:
Apache (mpm event) and php-fpm (UDS unix socket).
Settings under which I see a problem:
cgi pathino fix value "1".
For more information, apache settings for php are configured correctly and everything is fine in the .htacces file too. The problem is that when accessing non-existent php files, apache processes correctly and responds with a 404 error, but php fpm still tries to process a non-existent php file and responds with a primary script unknown error.
I also observed a problem using php unix socket in apache, namely when using only unix socket in php with cgi path info value 0 set, php did not correctly handle script file name or script file path.
These are very important issues for using php fpm unix socket in apache.
 [2020-02-10 00:19 UTC] sainthyoga2003 at gmail dot com
Updated to 7.4.2 in openSUSE Tumbleweed latest release, the same problem. I think because this issue, in AWS the main PHP version is the 7.3.11

What's news about it?
 [2020-02-14 13:12 UTC] demo dot knyang at gmail dot com
I had the similar problem.

OS: 4.19.102-1-MANJARO
PHP Version: 7.4.2
Nginx Version: 1.16.1
Service Manager: Systemd 242

Nginx error log: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream.

While, all was running ok with php 7.2.26.

Finally, I found that the problem was caused by systemd php-fpm.service configuration. My project is located in $HOME directory. And in php-fpm.service for php 7.4.2, there is one line "ProtectHome=true". Change this option to false took effects.

It works for me, for reference only.
 [2020-02-14 13:17 UTC] nikic@php.net
-Assigned To: +Assigned To: bukka
 [2020-02-14 13:17 UTC] nikic@php.net
systemd service changes strike again! @bukka: Do you think we should drop the ProtectHome option from the default?
 [2020-02-23 19:14 UTC] bukka@php.net
Automatic comment on behalf of bukka
Revision: http://git.php.net/?p=php-src.git;a=commit;h=578a8113ebade39e68489c974cd6c16b2aecbf2e
Log: Fix bug #79014 (PHP-FPM &amp; Primary script unknown)
 [2020-02-23 19:14 UTC] bukka@php.net
-Status: Assigned +Status: Closed
 [2020-02-23 19:15 UTC] bukka@php.net
Automatic comment on behalf of bukka
Revision: http://git.php.net/?p=php-src.git;a=commit;h=578a8113ebade39e68489c974cd6c16b2aecbf2e
Log: Fix bug #79014 (PHP-FPM &amp; Primary script unknown)
 [2020-02-23 19:16 UTC] bukka@php.net
@nikic yeah just dropped it. Hopefully it's the last fix for systemd changes...
 [2020-03-01 18:15 UTC] bukka@php.net
-Package: *General Issues +Package: FPM related
 [2020-09-14 19:48 UTC] support at lunaria dot co dot uk
PHP 7.4.10 (FPM), apache 2.4, cPanel 90.0.8 CentOS 7.8
I'm still seeing this bug in my system error log.
[Mon Sep 14 20:36:15.115925 2020] [proxy_fcgi:error] [pid 26994] [client 94.195.123.222:59049] AH01071: Got error 'Primary script unknown'
Steps to reproduce:
Any HTTP request to diverecorder.co.uk that doesn't result in a 200.
Have checked .htaccess rules, all okay
Checked /opt/cpanel/ea-php74/root/etc/php-fpm.d
Can't find ""ProtectHome=true" in config.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 09:01:28 2024 UTC