我已经检查了是否在ubuntu 14.04中使用aptitude安装了apache,mysql和php,并且都已安装 .
但是当(文件保存为info.php)
<?php phpinfo(); ?>
以上文件保存在var / www / html目录中,当尝试使用url localhost / info.php从broswer访问文件时,它显示为
有什么问题?任何帮助?
你需要这个:
apt-get install libapache2-mod-php5 sudo a2enmod php5 sudo service apache2 restart
或者(如果您已经安装了那些)
AddType application/x-httpd-php .php
在apache的配置文件中
除了Alex Tartan的回答,您还需要:
<FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch>
你的 php5.conf
php5.conf
这样做不是提供index.html文件等,而是提供index.php文件 .
见:https://serverfault.com/questions/286882/apache-is-not-interpreting-php-files
2 回答
你需要这个:
或者(如果您已经安装了那些)
在apache的配置文件中
除了Alex Tartan的回答,您还需要:
<FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch>
你的
php5.conf
这样做不是提供index.html文件等,而是提供index.php文件 .
见:https://serverfault.com/questions/286882/apache-is-not-interpreting-php-files