44

I am trying to upgrade PHP 5.5.9 to PHP 7 on my DigitalOcean Ubuntu 14.04 machine.

I've read many tutorials and articles how to do it, but each of them misses something. For example, somewhere they say you must sudo a2dismod php5 then sudo a2enmod php7. The problem is that I always get this message

$ sudo a2enmod php7
ERROR: Module php7 does not exist!

Does someone one how to resolve this problem, please?

Thanks in advance.

atorscho
  • 2,069
  • 2
  • 15
  • 20
  • 1
    This is the official tutorial about this. Have you read it? https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-ubuntu-14-04 – Ed de Almeida Mar 17 '16 at 10:27
  • 2
    I think you will need to do sudo apt-get install php7.0 before this command your are running. – Ed de Almeida Mar 17 '16 at 10:28
  • This is the first tutorial I've read, and yes already `sudo apt-get install php7.0`. :/ I really have no idea why it does not work. – atorscho Mar 18 '16 at 11:42
  • 1
    Next ste is checking if the module was really installed. I don't know exactly where PHP modules are stored in Ubuntu, but a little google research will tell us. – Ed de Almeida Mar 18 '16 at 12:03
  • 2
    If I am not mistaken, apache modules are in `/etc/apache2/mods-available`, and after `sudo a2enmod` they are present in `/etc/apache2/mods-enabled` also. I found there two PHP 5 files: `php5.conf` and `php5.load`, but no presence of PHP 7. – atorscho Mar 18 '16 at 18:23
  • 4
    For those who downvote, you could at least explain why you do so. :/ – atorscho Mar 18 '16 at 22:32
  • Your question does not follow the guidelines for questions on StackOverflow. Try to reword it thinking in terms of how others might have the same problem. – motorbaby Mar 06 '17 at 18:36
  • I don't care if this question is "off topic", I'm glad it was here! I did a lot of searching before finding this and immediately solved my problem. Also, this comment is probably off topic, feel free to delete it. – Stack Underflow May 21 '18 at 22:54

1 Answers1

141

Finally, thanks to the comment of Ed de Almeida, I found the solution.

I had to install an additional package:

$ sudo apt-get install libapache2-mod-php7.0

Now I could run sudo a2enmod php7.0.

atorscho
  • 2,069
  • 2
  • 15
  • 20