[英]AddType application/x-httpd-php .php is not rendering PHP
添加此代碼:
AddType application/x-httpd-php .php
之后
...
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
到C:\\Apache24\\bin\\httpd.conf
下載我系統上的所有 PHP 頁面而不是呈現它。
在此之前,PHP 頁面被解析為原始文本。
需要幫助!
有兩個問題:
application/x-httpd-php
不是 MIME 類型,而是一個處理程序。 這意味着您的指令必須是AddHandler
而不是AddType
application/x-httpd-php
不是有效的處理程序。 處理程序必須在字符串末尾包含 PHP 版本數字
總而言之,假設 PHP 7.2 版,你想要的是
✅ AddHandler application/x-httpd-php72 .php
而不是
🚫 AddType application/x-httpd-php .php
add this at the bottom of your httpd.conf make sure you have php{version}apache{version}.dll in line 3 and directory of your php.
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php .html
LoadModule php7_module "c:/php7/php7apache2_4.dll"
PHPIniDir "c:/php7"
你可以訪問這個鏈接
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.