我已經(jīng)根據(jù)此 linode 指南設(shè)定了 php/apache:https://www.linode.com/docs/guides/install-php-8-for-apache-and-nginx-on-ubuntu/
這似乎有效,我有一個(gè) apache 伺服器,可以提供檔案服務(wù),並處理 .php
檔案。
但是,我正在花時(shí)間弄清楚如何告訴 apache 使用 .php
處理 .html 檔案。我對.htaccess
(a-la- https://manage.accuwebhosting.com/knowledgebase/2492/Parse-HTML-As-PHP-Using-HTACCESS-File.html 等)所做的任何修改都不會(huì)產(chǎn)生任何變化。我還將 AllowOverride All
設(shè)定為 /etc/apache2/apache2.conf
中的 /var/www/
目錄。此外,大多數(shù)有關(guān)該主題的線上資訊都指向 .php
的早期版本,沒有具體提及 8.0
。
什麼可以讓apache用
8.0
處理.html
?
您需要為此模組,確認(rèn)您在 httpd.conf 中有此行??,或?qū)⑵湫略鲋疗渲校?/p>
LoadModule mime_module modules/mod_mime.so
另請檢查您的系統(tǒng)上是否存在 modules/mod_mime.so
檔案。
然後在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
指令 AllowOverride All
將啟用 .htaccess 文件,但您還需要啟用 mime_module。
當(dāng)然,在更改配置後重新啟動(dòng) apache 伺服器。
模組文件:此處
#