您的位置:首页 > 运维架构 > Linux

ubuntu Linux 测试PHP却提示下载文件的解决办法

2016-08-05 15:21 549 查看

ubuntu Linux 测试PHP却提示下载文件的解决办法

一般这种情况都是在刚刚开始配置环境时出现的,
输入 sudo a2enmod php5 看提示如果出现“$ This module does not exist!”,
那么你就应该彻底删除libapache2-mod-php5并且重新安装,彻底删除可以用--purge参数,如下所示:
sudo apt-get remove --purge libapache2-mod-php5
sudo apt-get install libapache2-mod-php5

过程如下:

输入的命令用*******表示

**************************** dante@ubuntu:/var/www$ sudo a2enmod php5
[sudo] password for dante:
ERROR: Module php5 does not exist!
dante@ubuntu:/var/www$ sudo apt-get remove --purge libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libapache2-mod-php5 is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 312 not upgraded.
*********************** dante@ubuntu:/var/www$ sudo apt-get install ibapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ibapache2-mod-php5
********************* dante@ubuntu:/var/www$ sudo apt-get install libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-prefork php5-cli php5-common
Suggested packages:
php-pear php5-suhosin
The following packages will be REMOVED:
apache2-mpm-worker
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 php5-cli php5-common
0 upgraded, 4 newly installed, 1 to remove and 312 not upgraded.
Need to get 3,085 kB/6,612 kB of archives.
After this operation, 17.7 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
apache2-mpm-prefork php5-common libapache2-mod-php5 php5-cli
Install these packages without verification [y/N]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ oneiric-updates/main php5-cli i386 5.3.6-13ubuntu3.3 [3,085 kB]
Fetched 3,085 kB in 4min 14s (12.1 kB/s)
dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you requested:
apache2 depends on apache2-mpm-worker (= 2.2.20-1ubuntu1.1) | apache2-mpm-prefork (= 2.2.20-1ubuntu1.1) | apache2-mpm-event (= 2.2.20-1ubuntu1.1) | apache2-mpm-itk (= 2.2.20-1ubuntu1.1); however:
Package apache2-mpm-worker is to be removed.
Package apache2-mpm-prefork is not installed.
Package apache2-mpm-event is not installed.
Package apache2-mpm-itk is not installed.
(Reading database ... 168658 files and directories currently installed.)
Removing apache2-mpm-worker ...
* Stopping web server apache2
... waiting ...done.
Selecting previously deselected package apache2-mpm-prefork.
(Reading database ... 168654 files and directories currently installed.)
Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork_2.2.20-1ubuntu1.1_i386.deb) ...
Setting up apache2-mpm-prefork (2.2.20-1ubuntu1.1) ...
* Starting web server apache2
...done.
Selecting previously deselected package php5-common.
(Reading database ... 168659 files and directories currently installed.)
Unpacking php5-common (from .../php5-common_5.3.6-13ubuntu3.3_i386.deb) ...
Selecting previously deselected package libapache2-mod-php5.
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.3.6-13ubuntu3.3_i386.deb) ...
Selecting previously deselected package php5-cli.
Unpacking php5-cli (from .../php5-cli_5.3.6-13ubuntu3.3_i386.deb) ...
Processing triggers for man-db ...
Setting up php5-common (5.3.6-13ubuntu3.3) ...
Setting up libapache2-mod-php5 (5.3.6-13ubuntu3.3) ...

Creating config file /etc/php5/apache2/php.ini with new version
* Reloading web server config apache2
...done.
Setting up php5-cli (5.3.6-13ubuntu3.3) ...

Creating config file /etc/php5/cli/php.ini with new version
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode.
******************* dante@ubuntu:/var/www$ sudo service apache2 restart
* Restarting web server apache2
... waiting ...done.

到此问题解决
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐