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

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

问题描述

在我的新的Ubuntu系统,我已经成功地得到的Apache2启动并运行了发展我ZendFramework Web应用程序...

我有我的可用的网站配置正常工作,因为我能够要求本地主机和它的服务器了正确的 index.html的从我指定的目录。

问题:如果我要求的index.php ,火狐试图下载该文件,而不是运行脚本

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

我添加以下内容的httpd.conf ,但它并没有帮助。

  AddHandler的应用程序/ X的httpd  -  PHP .php5 .php4的.php .php3 .php2一个.phtml将AddType应用/ X的httpd  -  PHP .php5 .php4的.php .php3 .php2一个.phtml


解决方案

如果Firefox的下载PHP文件则意味着已安装到服务器犯规PHP或Apache的PHP模块。

有你安装apache PHP模块?
如果没有,那么安装它,通过键入以下到终端:

 命令和apt-get安装中的libapache2-MOD-PHP5

,如果是,你有你的index.php位于 /无功/网络/

确认,以便能够与PHP命令

 须藤a2enmod PHP5

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

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.

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

Any Ideas why this would happen?

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

解决方案

if firefox downloads your php files it means that your server doesnt have php or the apache php module installed.

have you install apache php module? if not, then install it, by typing this into a terminal:

sudo apt-get install libapache2-mod-php5

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

Make sure to enable php with the command

sudo a2enmod php5

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

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