Fedora 42
Sponsored Link

Nginx : Use PHP Scripts2025/05/06

 

Configure httpd to use PHP scripts.

[1] Install PHP.
[root@www ~]#
dnf -y install php php-mbstring php-pear
[2]

After installing PHP, Restart httpd, it's OK to do it only.

PHP-FPM (FPM : FastCGI Process Manager) is configured by default.
When [nginx] starts, [php-fpm] also starts for dependency by setting file [/usr/lib/systemd/system/nginx.service.d/php-fpm.conf].
[root@www ~]#
systemctl restart nginx

[root@www ~]#
systemctl status php-fpm

● php-fpm.service - The PHP FastCGI Process Manager
     Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             +-- 10-timeout-abort.conf, 50-keep-warm.conf
     Active: active (running) since Tue 2025-05-06 08:53:57 JST; 4s ago
 Invocation: d956cd2771ad4f18b681fa8ddb648643
   Main PID: 2065 (php-fpm)
     Status: "Ready to handle connections"
      Tasks: 6 (limit: 4640)
     Memory: 12.7M (peak: 13M)
        CPU: 33ms
     CGroup: /system.slice/php-fpm.service
.....
.....

# create PHPInfo test page

[root@www ~]#
echo '<?php phpinfo(); ?>' > /usr/share/nginx/html/info.php

[3] Verify to access to PHPInfo test page from any client computer.
Matched Content