I've installed php7 on my droplet but according to my phpinfo I still use php 5.59

March 26, 2016 461 views
Apache Nginx PHP WordPress

Hi there guys, so I installed Vesta control panel on my 1gb memory droplet. I've got nginx running in the front and apache in the back.

I've upgraded to php 7 with putty and when I type in "php -v" in the CL, it shows that I'm running php 7.

So in order to test things out, I decided to create a file called phpinfo and when I run it, it says that I'm running "5.5.9-1ubuntu4.14"

I've also got Wordpress installed and when I run the system status, it also shows that I'm using 5.5.9

SO now I'm confused. Which version am I really using and how can I switch (default) to php7?

Thank you for your input

1 Answer

Without knowing what distro you are using or how you upgraded to PHP 7, it is hard to give a thorough answer. Assuming you are on Ubuntu 14.04 and used the packages from the ondrej/php PPA, here are some things to check.

The way PHP is now packaged, you are able to co-install both PHP 5 and PHP 7. So it is possible to have both versions working with different applications.

If your PHP is being executed by Apache's mod_php, first ensure that you have the package libapache2-mod-php7.0 installed on your system. Then, disable the PHP 5 version and enable the PHP 7 one:

  • sudo a2dismod php5
  • sudo a2enmod php7.0
  • sudo service apache2 restart

If Nginx is serving the PHP application using PHP-FPM, then ensure that the php7.0-fpm package is installed on your system. Then update your Nginx configuration's fastcgi_pass directive from:

fastcgi_pass unix:/var/run/php5-fpm.sock


fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

Remember to restart Nginx for the changes to take effect: sudo service nginx restart

Have another answer? Share your knowledge.