简体   繁体   English

LAMP服务器安装失败。当复制到var / www / html /中时,本地主机未列出诸如codeigniter之类的目录

[英]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. 我已经检查了apache,mysql和php是否使用aptitude安装在ubuntu 14.04中,并且都已安装。

but when (file is saved as info.php) 但是当(文件另存为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 上面的文件保存在var / www / html目录中,当尝试使用url localhost / info.php从浏览器访问文件时,它显示为

在此处输入图片说明

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 在Apache的配置文件中

In addition to Alex Tartan's answer you will also need: 除了Alex Tartan的答案,您还需要:

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

Within your php5.conf 在您的php5.conf

This is so instead of serving up an index.html file etc. it will serve up an index.php file. 这样可以代替提供index.html文件等。它将提供index.php文件。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在默认 var/www/html 文件夹内的实时服务器中,如果没有 index.php,codeigniter 路由将无法工作 - codeigniter routes not working without index.php in live server inside default var/www/html folder 无法从AWS Lite上的服务器/ var / www / html加载index.php codeigniter文件 - index.php codeigniter file doesn't load from server /var/www/html on aws lite 在 Ubuntu 16.04 LTS 上的 var/www/html/ 中运行 Codeigniter 项目时找不到 404 页面? - 404 Page Not Found when run Codeigniter project inside var/www/html/ on Ubuntu 16.04 LTS? SQLSTATE[HY000] [2002] 连接尝试失败.. - 尝试从本地连接到远程服务器时 - SQLSTATE[HY000] [2002] A connection attempt failed.. - When attempting to connect from Local to remote server 本地主机没有在 /var/www/html 中显示我的文件 - Localhost doesnt show my files in /var/www/html 404 Not Found尝试访问本地LAMP服务器上的localhost时出错 - 404 Not Found Error when trying to access localhost on local LAMP server 无法访问var / www ubuntu中的复制文件 - Can not access copied filesin var/www ubuntu 在/ var / www / html中编辑 - editing in /var/www/html 网址不以后缀.html结尾时,CodeIgniter失败 - CodeIgniter failed when the url does not end with the suffix .html 仅获取/ var / www / html文件夹中的文件列表 - Only getting list of files on /var/www/html folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM