Linux Level 04 - Install and Configure PHP-FPM - Validation issue

Getting this error:

  • The URL is displaying ‘index.php’ in plain text, which indicates that either PHP-FPM is not installed, or Nginx is not configured to work with PHP-FPM.

Solution:

ssh steve@stapp02
sudo -i

dnf install -y nginx
dnf module -y install php:8.1/common

vi /etc/php-fpm.d/www.conf
listen = 9000
user = nginx
group = nginx

vi /etc/nginx/nginx.conf
server {
listen 8093 default_server;
listen [::]:8093 default_server;
server_name _;
root /var/www/html;

location ~ \.php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

error_page 404 /404.html;
    location = /40x.html {
}

error_page 500 502 503 504 /50x.html;
    location = /50x.html {
}

}

chown nginx:nginx /var/www/html/index.php

systemctl enable php-fpm --now
systemctl enable nginx --now

[steve@stapp02 ~]$ curl http://stapp02:8093/index.php

404 Not Found

404 Not Found


nginx/1.20.1

Guide me what went wrong.

Hi @sakthinandhan

Please share the course level and task name, I’ll check it and get back to you.

Linux Level 04 - 08. Install and Configure PHP-FPM

Hi @sakthinandhan

I didn’t see any issues with your NGINX and PHP setup. Did you restart the PHP-FPM and NGINX services after making the changes? I just checked, and I was able to access the site with NGINX forwarding correctly to PHP-FPM.

for me also it’s working - it’s issue while checking - I’m unable to pass the task.

any solution for this!

Hi @sakthinandhan

This is a real problem with the validation. I couldn’t complete the task either. I’ve sent it to the team to check, and I’ll keep you updated.

@sakthinandhan

After checking with the team, this is not an issue. We may have missed some configuration, so php-fpm didn’t install properly. I’ve retried, and it’s working now. Please try again.