Score:0

AmazonLinux 2022 Fails to Run PHP Scripts - Error AH02454

cn flag

I am attempting to run basic PHP scripts on an Amazon Linux 2022 or Amazon Linux 2023 server instance. I followed the directions here and when I request index.html it serves a static page fine. However, when I created the simple index.php page containing only

<?php phpinfo(); ?>

I get an error code 503:

Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

and

[info] (13)Permission denied: AH02454: FCGI: attempt to connect to Unix domain socket /run/php-fpm/www.sock (*:80) failed
[info] [client ip AH01079: failed to make connection to backend: httpd-UDS

I have been working on file permissions and missing packages, but nothing has worked to date. Other searches indicate this could be a permissions issue, but I am unsure what to change. We got the same behavior off of AL2022 and AL2023, but had some success with AmazonLinux 2, possibly because we are not using PHP-FPM on the (much) older image.

What causes this issue and how do I fix it?

Tim avatar
gp flag
Tim
PHP works fine on Amazon Linux. Look at the permissions on your socket. Try a different tutorial if that one isn't working.
Steve avatar
cn flag
@Tim Working from the Official AWS LAMP on AL2022 Guide, or the official AWS Wordpress on AL2022 Guide, or others does not seem to work. It appears that AL2022, PHP8.1, and new-ish PHP-FPM may have an issue.
Tim avatar
gp flag
Tim
Not all tutorials are perfect. As I said above, the error seems to be permissions. Make sure whatever user php / fpm is running as has permissions to access the /run/php-fpm/www.sock socket. On Ubuntu my `/etc/php/7.4/fpm/pool.d/www.conf file` points at /run/php/php7.4-fpm.sock which has permissions `srw-rw---- 1 www-data www-data`. Different version but maybe it'll help.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.