Arch: Primary script unknown after upgrade to 7.4.0Saturday, December 7 2019 · Lesezeit: 2 Minuten · 308 Wörter Achtung! Dieser Artikel ist älter als ein Jahr. Der Inhalt ist möglicherweise nicht mehr aktuell!
Do you know that? Everything is running fine, you update, reboot and it’s fucked up? Normally that doesn’t happen on Arch :-)
But on a friday night it has to happen to me. What happened exactly? After the reboot I’ve found the following log message:
*26 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
And of course the PHP application was not working anymore. Googling this error message leads to one solution: You have to set SCRIPT_FILENAME as FastCGI parameter. Tracing with tcpdump between nginx und php-fpm showed this:
The fucking variable was set an right! I was able to execute it with the user php-fpm is running. The filesystem persmissions were also correct. I did not change anything! AppArmor, SELinux whatever was not blocking it. Fucking PHP shit!
Then it hit me! Well … to be honest: The wise people from the Arch forum pointed me in the right direction. The php-fpm systemd service has
ProtectHome set to
true since 7.4.0! I don’t know why this is enabled for a service like php but the maintainer for sure has a reason. Actually … I totally understand why. Normally websites are stored under
/var/www. However I’ve decided that my files are stored in
The solution is to set it to false. But don’t fiddle with the maintainers service file! Instead create an override:
systemctl edit php-fpm
Add the following:
This will create an override file under
Reload the systemd daemon:
systemctl daemon-reload. If that worked a status should print a drop-in:
● php-fpm.service - The PHP FastCGI Process Manager Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/php-fpm.service.d └─override.conf
Restart php-fpm and you should be fine now. Now the maintainers service file can change, your overrides are still present afterwards and your PHP application works again. Hooorayyyy!
Du hast einen Kommentar, einen Wunsch oder eine Verbesserung? Schreib mir doch eine E-Mail! Die Infos dazu stehen hier.
🖇️ = Link zu anderer Webseite
🔐 = Webseite nutzt HTTPS (verschlüsselter Transportweg) Zurück