12/04/2021

Configure PHP for Apache

Configure php for Apache

1. Add remi repository:

yum install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Install php:

yum install php

2. Create a .php file in your Apache DocumentRoot and paste the following:

<?php
phpinfo();
?>

3. Load php module in Apache by adding the following line in your module configuration file if it is not present:

LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so

4. Add the following lines to the vhost

<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

5.Edit conf.modules.d/00-mpm.conf to comment:

LoadModule mpm_event_module modules/mod_mpm_event.so

and uncomment:

LoadModule mpm_prefork_module modules/mod_prefork_event.so

6. Access your server through a browser and you should see informaton about php:

Leave a Reply

Your email address will not be published.