乌班图15.10.安装了php,但浏览器下载页面而不是打开


Ubuntu 15.10. Installed php but browser download pages instead of open

我正在 UBUNTU 上安装 LAMP,我遵循了本指南,但在最后一步,当我编写 info.php 页面并尝试打开它时,通过浏览器下载它而不是打开它。我用谷歌搜索了这个问题,但我没有找到解决方案。你有吗?

编辑:我实际上解决了安装问题

sudo apt-get install php5-pgsql

问题是现在,虽然我重新启动了 apache,但我永远看不到该页面。始终找不到 404。

这意味着您的服务器没有安装PHP或Apache PHP模块。

sudo apt-get install libapache2-mod-php5

如果您已安装,那么您的索引.php是否位于/var/www/

确保使用命令启用 PHP

sudo a2enmod php5

案例 :2

您正在将PHP文件作为C盘上的文件进行访问(例如。 C:'xampp'htdocs'index.phpfile:///c:/xampp/htdocs/index.php(而不是网页(即//localhost/index.php(。

案例 :3

默认情况下不启用 mcrypt 模块。启用 mcrypt 模块,然后重新启动 Apache 。

sudo php5enmod mcrypt
sudo service apache2 restart

案例 : 4

检查您正在使用的端口通常为8080,并且mysql在443端口上运行。如果您使用端口文件路径,例如:

http://localhost:8080/index.php
在某些情况下,端口

需要在Skype中使用80进行更改,因此您将端口从工具>选项>高级替换,使其不同端口。