4

I'm trying to enable mod_php on Ubuntu. I'm getting

/etc$ sudo a2enmod mod_php
ERROR: Module mod_php does not exist!

But I believe it's already installed from

etc$ sudo apt-get install libapache2-mod-php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libapache2-mod-php5 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 91 not upgraded.

Any advice?

1
  • Which Ubuntu version? Commented Jan 2, 2019 at 16:09

4 Answers 4

8

I would try this command: sudo a2enmod php5

Also, please look here. There's an extremely good chance you don't even need "a2enmod" to get things working:

http://php.net/manual/en/install.unix.debian.php

http://chipersoft.com/p/Setting-up-a-LAMP-server-ubuntu/

Sign up to request clarification or add additional context in comments.

Comments

2

Did you try mod_php5? Haven't used ubuntu in a couple years but I think you can look at the module names in /etc/apache2/mods-available (and even symlink them to /etc/apache2/mods-enabled, which is pretty much what a2en does

Comments

0

On Mageia5 you can enable it like this:

urpmi apache-mod_php
systemctl restart httpd.service

Comments

0

Running this command, should install Apache 2.x and install the latest validated PHP and enable it as well. (Validated with Ubuntu).

sudo apt-get install apache php

If PHP is not installed, run with php5.6 or php7.0 or php7.1 or php7.2 instead.

sudo apt-get install apache php5.6
sudo apt-get install apache php7.0
sudo apt-get install apache php7.1
sudo apt-get install apache php7.2

You way want to checkout ondrej/php if your Ubuntu doesn't include the latest PHP version.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.