[英]php code is written to output as plain text, why?
我已經在Linux上安裝了Apache服務器和php5,但無法執行並在瀏覽器中顯示一個簡單的php文件。 我在瀏覽器中看到的是:
<?php echo 'hello';?>
為什么未執行php代碼?
這是/etc/apache2/sites-available/default
文件的內容:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/public
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
我已經將我的測試php文件放在/var/www/public
考慮這些:
好吧,您有一個缺少的容器,這是帶有回聲回調的條件。
if($result) {
echo "success";
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.