I have set up php/apache according to this linode guide: https://www.linode.com/docs/guides/install-php-8-for-apache-and-nginx-on-ubuntu/
This seems to work, I have an apache server that serves files and handles .php
files.
However, I'm taking the time to figure out how to tell apache to use .php
to handle .html files. Anything I do with .htaccess
(a-la- https://manage.accuwebhosting.com/knowledgebase/2492/Parse-HTML-As-PHP-Using-HTACCESS-File.html etc.) Modifications will not produce any changes. I also set AllowOverride All
to /etc/apache2/apache2.conf
in the /var/www/
directory. Additionally, most online information on the subject points to earlier versions of .php
, with no specific mention of 8.0
.
What can let apache use
8.0
to process .html
?
P粉3739908572024-01-17 09:55:22
You need this module, confirm you have this line in httpd.conf, or add it to it:
LoadModule mime_module modules/mod_mime.so
Also check if the modules/mod_mime.so
file exists on your system.
Then find or add the module section in httpd.conf:
# following line will change mime type of .html file to php # and they will be handled as such AddType application/x-httpd-php .html
Directive AllowOverride All
will enable .htaccess files, but you also need to enable mime_module.
Of course, restart the apache server after changing the configuration.
Module documentation: here