我在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
答案 0 :(得分:1)
考虑这些:
答案 1 :(得分:-3)
嗯,你有一个容器丢失了,这里是回调回调的条件。
if($result) {
echo "success";
}