Configure httpd to use PHP scripts.
First, install PHP on your server. Refer to the appropriate PHP installation guide for your system.
After installing PHP, restart the httpd service. PHP-FPM (FastCGI Process Manager) is configured by default. When httpd starts, php-fpm also starts due to dependencies set in the file /usr/lib/systemd/system/httpd.service.d/php-fpm.conf.
# Restart httpd service
[root@www ~]# systemctl restart httpd
# Check the status of php-fpm
[root@www ~]# systemctl status php-fpm
# Expected output
# * php-fpm.service - The PHP FastCGI Process Manager
# ...
# Active: active (running) since ...
# ...
Create a PHPInfo test page to verify the PHP setup.
# Create a phpinfo test page
[root@www ~]# echo '<?php phpinfo(); ?>' > /var/www/html/info.php
Access the PHPInfo test page from any client computer to verify PHP is functioning correctly.
http://[your-server's-domain-or-IP]/info.phpReplace [your-server's-domain-or-IP] with your server's domain name or IP address. You should see the PHP information page displayed in the browser, confirming that PHP is working correctly.