[英]php code is written to output as plain text, why?
I've installed apache server and php5 on linux, but am not able to get a simple php file executed and shown in browser. 我已经在Linux上安装了Apache服务器和php5,但无法执行并在浏览器中显示一个简单的php文件。 What I see in browser is this: 我在浏览器中看到的是:
<?php echo 'hello';?>
Why is the php code not executed? 为什么未执行php代码?
Here is the content of /etc/apache2/sites-available/default
file: 这是/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>
And I have place my test php file in /var/www/public
我已经将我的测试php文件放在/var/www/public
Consider these: 考虑这些:
Well you have the container missing for one,, here is a conditional with the echo call back. 好吧,您有一个缺少的容器,这是带有回声回调的条件。
if($result) {
echo "success";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.