Main »

Getting PHP working on Apache2

Started 18th March 2021

I found php was not working on the newly installed server running my web site, but php was installed...
It is necessary to install more than just php, libraries are needed:


sudo apt install php libapache2-mod-php php-mysql
sudo systemctl reload apache2
a2enmod php7.4


Good enough? Well I want php to parse all the html files served. I've got a .htaccess file containing:


AddType application/x-httpd-php .php .html


But it won't work until:


sudo nano apache2.conf


Then change None to All in AllOverride:


<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride All
	Require all granted
</Directory>


Also needed for graphics:


sudo apt-get install php7.4-gd
sudo service apache2 restart



Comments

Click to return to index

David Pilling's Wiki

Set view

Page last modified on March 18, 2021, at 03:09 AM - Powered by PmWiki (pmwiki-2.2.138)

^