简体   繁体   中英

LAMP server installaion failed.. localhost does not list directories like codeigniter when copied in var/www/html/

i have checked if apache , mysql and php are installed in ubuntu 14.04 using aptitude and all are installed.

but when (file is saved as info.php)

<?php
phpinfo();
?>

the above file is saved in var/www/html directory and when trying to access files from broswer using url localhost/info.php it shows like

在此处输入图片说明

what's the issue? any help?

You need this:

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

Or (if you already have those installed)

AddType application/x-httpd-php .php

in apache's config file

In addition to Alex Tartan's answer you will also need:

<FilesMatch "\\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch>

Within your php5.conf

This is so instead of serving up an index.html file etc. it will serve up an index.php file.

See: https://serverfault.com/questions/286882/apache-is-not-interpreting-php-files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM