将Apache2设置为处理.html文件为PHP 8.0
根据本Linode指南,我已经设置了PHP/Apache: https://www.linode.com/docs/guides/guides/install-php-8-for-apache-anpache-and-nginx-nginx-on-ubuntu/
我有一个可以使用文件的Apache服务器,并处理.php
文件。
但是,我有最糟糕的时间来弄清楚如何告诉Apache使用.php
来处理.html文件。我对.htaccess
进行任何修改file.html“ rel =” nofollow noreferrer“> https://manage.accuwebhosting.com/knowledgebase/2492/parse-html-as-as-php-usish-htaccess-file.html 和类似。我还将所有设置为/var/www/
目录/etc/apache2/apache2/apache2.conf
中。此外,有关主题的大多数在线信息都指向.php
的早期版本,而没有具体引用8.0
。
什么可以让Apache使用PHP
8.0
来处理.html
?
I have setup 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 have worked, and I have an apache server that can serve files, and process .php
files.
However, I am having the darndest time figuring out how to tell apache to process .html files with .php
. Any modification I make to .htaccess
(a-la- https://manage.accuwebhosting.com/knowledgebase/2492/Parse-HTML-As-PHP-Using-HTACCESS-File.html and similar) produce no change. I have also set AllowOverride All
to the /var/www/
directory in /etc/apache2/apache2.conf
. Additionally, most online information on the subject points to earlier versions of .php
, with no specific reference to 8.0
.
What can get apache to process .html
with php
8.0
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要为此提供模块,请确认您在httpd.conf中有此行,或在此处添加:
另外,请检查系统上存在
Modules/mod_mime.so
文件。然后在httpd.conf中查找或添加模块部分:
指令
allowoverride all
将启用.htaccess文件,但您也需要启用mime_module。当然,在更改配置后,重新启动Apache服务器。
模块文档:在这里
You need to have module for this, confirm you have this line in httpd.conf, or add it there:
Also check if you have the
modules/mod_mime.so
file present on your system.Then find or add module section in httpd.conf:
Directive
AllowOverride All
will enable .htaccess files but you need the mime_module enabled too.And of course restart the apache server after making configuration changes.
Module documentation: here