1 | initial version |
sudo apt-get update
sudo apt-get install apache2
sudo apt-get install php
sudo nano /etc/apache2/mods-enabled/dir.conf
Change the DirectoryIndex line to include index.php:
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo nano /etc/apache2/mods-enabled/php7.2.conf
Change the following lines to allow PHP files to be executed outside the cgi-bin directory:
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
sudo systemctl restart apache2
Now, Apache should be able to handle PHP files outside the cgi-bin directory.