且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Apache2的Ubuntu上 - PHP文件下载

更新时间:2023-02-22 11:07:00

如果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