i have encounter the following error message after task verification,
either ‘php-fpm’ is not installed or installed version is not ‘7.3’ on App Server 2
FAILED test_php_fpm.py::test_app - AssertionError: - either ‘php-fpm’ is not …
but i check again, service is running and version is correct.
[root@stapp02 ~]# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2023-11-12 05:29:22 UTC; 2min 52s ago
php-fpm -v
PHP 7.3.3 (fpm-fcgi) (built: Oct 22 2019 08:28:36)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
First, know what versions of PHP are available on the server already, and also know that php-fpm is installed by default from the system packages
sudo dnf module list php
If the question is asking a version that is not in this list, e.g. 8.2, press Try Later button, and reset the lab till you get a supported version. This saves messing with additional repos.
Once you have a version supported by the distro, proceed. In this case I got 7.4 as the requirement
Once you have logged into app server, do sudo -i to become root and save yourself a lot of typing sudo everywhere.
dnf module -y install nginx php:7.4/common
Now fix up php-fpm so it can work with nginx and listen on the given socket.
Open /etc/php-fpm.d/www.conf in vi
Edit the user = and group = lines to both use nginx instead of apache
Edit the listen = line to refer the path to the socket given in the question
Exit vi
Set directory permissions on php files to nginx group
chown -R root:nginx /var/lib/php
Fix up nginx
Open /etc/nginx/nginx.conf
Set given port number
Set given html directory
Insert configuration block for php-fpm within server { and replace PATH-TO-SOCKET with path given in question
I have followed your steps but encounter error, there is 7.4 in the list but it wont install.
ssh steve@stapp02
sudo -i
dnf module list php
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
CentOS Stream 8 - AppStream 8.5 kB/s | 4.4 kB 00:00
CentOS Stream 8 - AppStream 31 MB/s | 34 MB 00:01
CentOS Stream 8 - BaseOS 3.1 kB/s | 3.9 kB 00:01
CentOS Stream 8 - BaseOS 22 MB/s | 53 MB 00:02
CentOS Stream 8 - Extras 7.7 kB/s | 2.9 kB 00:00
CentOS Stream 8 - Extras common packages 9.6 kB/s | 3.0 kB 00:00
CentOS Stream 8 - Extras common packages 17 kB/s | 6.9 kB 00:00
Red Hat Universal Base Image 8 (RPMs) - BaseOS 1.5 MB/s | 717 kB 00:00
Red Hat Universal Base Image 8 (RPMs) - AppStream 6.1 MB/s | 3.0 MB 00:00
Red Hat Universal Base Image 8 (RPMs) - CodeReady Builder 350 kB/s | 103 kB 00:00
CentOS Stream 8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
php 8.0 common [d], devel, minimal PHP scripting language
Red Hat Universal Base Image 8 (RPMs) - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
php 8.0 common [d], devel, minimal PHP scripting language
This system is not registered with an entitlement server. You can use subscription-manager to register.
Last metadata expiration check: 0:01:48 ago on Wed Nov 15 03:24:22 2023.
No match for argument: php:7.4/common
Error: Unable to find a match: php:7.4/common
edit the nginx.conf:
server {
listen 8093;
listen [::]:8093;
server_name _;
root /var/www/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/default.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
edit the www.conf
; RPM: apache user chosen to provide access to the same directories as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx
; Note: This value is mandatory.
listen = /var/run/php-fpm/default.sock ( or /run/php-fpm/default.sock )
“I got the same error twice. Please help me with this. I’m running Nginx on the right server, and I’m using the curl command as given in the task. If the port is wrong, then how is that command working, especially considering that the same port is used in that command?”
It can work if you have configured the port consistently through the task, but if the port is not the one the question asks for then it will be incorrect.
The port is likely to be different each time you retry the question.
@34_Aniket-Kale Just to make absolutely sure the lab isn’t broken I did it a second time and it is not broken, so if it is not working for you, then you have made a mistake somewhere.
I have written up a detailed solution here.