ubuntu 上的 apache2 - php 文件下载 [英] apache2 on ubuntu - php files downloading

查看:43
本文介绍了ubuntu 上的 apache2 - php 文件下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的新 Ubuntu 系统上,我设法启动并运行了 Apache2 以开发我的 ZendFramework Web 应用程序...

On my new Ubuntu system, I've managed to get Apache2 up and running for developing my ZendFramework Web Applications...

我的 available-sites 配置工作正常,因为我能够请求 localhost 并且它提供正确的 index.html> 从我指定的目录.

I've got my available-sites config working correctly because I am able to request localhost and it servers up the correct index.html from my specified directory.

问题:如果我请求 index.php,firefox 会尝试下载文件而不是运行脚本.

Problem : if I request index.php, firefox attempts to download the file instead of running the script.

任何想法为什么会发生这种情况?

Any Ideas why this would happen?

我已将以下内容添加到 httpd.conf 中,但没有帮助.

I've added the following to httpd.conf but it hasn't helped.

AddHandler application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml

AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml

推荐答案

如果 Firefox 下载了您的 PHP 文件,则意味着您的服务器没有安装 PHP 或 Apache PHP 模块.

If Firefox downloads your PHP files it means that your server doesn't have PHP or the Apache PHP module installed.

您是否安装了 Apache PHP 模块?如果没有,请在终端中输入以下内容进行安装:

Have you installed the Apache PHP module? If not then install it by typing this into a terminal:

sudo apt-get install libapache2-mod-php5

如果是,您的 index.php 是否位于 /var/www/ 中?

And if yes, do you have your index.php located in /var/www/?

确保使用命令启用 PHP

Make sure to enable PHP with the command

sudo a2enmod php5

这篇关于ubuntu 上的 apache2 - php 文件下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆