0

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?

3
  • 1
    PHP works fine on Amazon Linux. Look at the permissions on your socket. Try a different tutorial if that one isn't working.
    – Tim
    Mar 6, 2023 at 19:01
  • @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.
    – Steve
    Mar 6, 2023 at 21:29
  • 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.
    – Tim
    Mar 6, 2023 at 22:01

0

You must log in to answer this question.

Browse other questions tagged .