Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't enable php as apache2 module

During Ubuntu server setup, I got to the point where I need to enable php as apache2 module. I tried running sudo a2enmod php5, but it returned ERROR: Module php5 does not exist!

After a bit of searching, I stumbled upon this tip by gerard :

If sudo a2enmod php5 returns "$ This module does not exist!", you should purge (not just remove) the libapache2-mod-php5 package and reinstall it. Be sure to clear your browser's cache before testing your site again."

Running sudo apt-get --purge remove libapache2-mod-php5 however, returned Package libapache2-mod-php5 is not installed, so not removed . Naturally, I tried to install it with sudo apt-get install libapache2-mod-php5, but then I get :

    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies.
    libapache2-mod-php5 : Depends: libxml2 (>= 2.8.0) but 2.7.8.dfsg-5.1ubuntu4.6 is to be installed
    Recommends: php5-cli but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

I tried to update && upgrade in hopes libxml2 would get updated, but didn't happen. I also tried installing php5-cli, but got :

    The following packages have unmet dependencies.
    php5-cli : Depends: libxml2 (>= 2.8.0) but 2.7.8.dfsg-5.1ubuntu4.6 is to be installed
               Depends: libedit2 (>= 2.11-20080614-4) but 2.11-20080614-3ubuntu2 is to be installed
    E: Unable to correct problems, you have held broken packages.

At this point I am lost. Running php -v, indicates that php is running, however:

    PHP 5.4.17 (cli) (built: Aug  7 2013 11:40:38) 
    Copyright (c) 1997-2013 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
like image 722
Evaldas Raisutis Avatar asked Aug 07 '13 12:08

Evaldas Raisutis


1 Answers

You can't install PHP 5.4.17 under Ubuntu 12.04, because the required libxml2 library >= v2.8.0 is only available in Ubuntu 12.10 (Quantal quetzal) or higher. Solution: Get a newer version of Ubuntu.

like image 158
ciruvan Avatar answered Sep 30 '22 05:09

ciruvan