This was a really fun and quickly lab that I had one week ago and I decided to publish. So the lab it was basically install Apache and PHP on any linux, in my case I’m a fan of Arch Linux and of course Arch user so if you have another linux version based on Arch like Manjaro you can install in the same way.
In my case I had already installed the Apache and the Mysql but not the PHP, so let go to the deal. Arch is use pacman as a package manager and is really easy to use, so first to install Apache
and done, to install mysql and I choose MariaDB as my engine db
done, and to install PHP we need to install this packages
and
Now with the php already installed, we need to enable the php with apache, so following the arch wiki documentation, we need to add some lines in the http.conf of the apache.
By default the http.conf of the apache is in this path /etc/httpd/conf/httpd.conf, so first we have a little note of the arch wiki;
Note: libphp5.so included with php-apache does not work with mod_mpm_event (FS#39218). You’ll have to use mod_mpm_prefork instead.
To use mod_mpm_prefork, open /etc/httpd/conf/httpd.conf and replace
with
As an alternative, you can use mod_proxy_fcgi (see #Using php5 with php-fpm and mod_proxy_fcgi below).
To enable PHP, add these lines to /etc/httpd/conf/httpd.conf: Place this in the LoadModule list anywhere after LoadModule dir_module modules/mod_dir.so:
Place this at the end of the Include list:
To test whether PHP was correctly configured: create a file called phpinfo.php in your Apache DocumentRoot directory (e.g. /srv/http/ or ~/public_html) in my case I created a folder “phpinfo” with the following contents:
References: