首页 文章

LAMP服务器安装失败..在var / www / html /中复制时,localhost不会列出像codeigniter这样的目录

提问于
浏览
0

我已经检查了是否在ubuntu 14.04中使用aptitude安装了apache,mysql和php,并且都已安装 .

但是当(文件保存为info.php)

<?php
phpinfo();
?>

以上文件保存在var / www / html目录中,当尝试使用url localhost / info.php从broswer访问文件时,它显示为

enter image description here

有什么问题?任何帮助?

2 回答

  • 0

    你需要这个:

    apt-get install libapache2-mod-php5
    sudo a2enmod php5
    sudo service apache2 restart
    

    或者(如果您已经安装了那些)

    AddType application/x-httpd-php .php
    

    在apache的配置文件中

  • 2

    除了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

相关问题