Force Apache to use PHP 7.2 Debian 8

0

I just updated PHP version from 5.6 to 7.2on my Debian 8 server,

On my info.php, i got :

PHP Version 7.2.14-1+0~20190113100657.14+jessie~1.gbpd8

On my server with php -v command :

# php -v
PHP 7.2.14-1+0~20190113100657.14+jessie~1.gbpd83c69 (cli) (built: Jan 13 2019 10:30:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.14-1+0~20190113100657.14+jessie~1.gbpd83c69, Copyright (c) 1999-2018, by Zend Technologies

But, on my wordpress , I still have PHP 5.6 :

You are running WordPress 5.0.3 | PHP 5.6.30-0+deb8u1 | Apache/2.4.10 (Debian) | MySQL 5.5.54-0+deb8u1

I already have Apache restarted, but it does not support PHP 7.2.

sim simo

Posted 2019-01-29T14:58:51.810

Reputation: 1

PHP from the command line has nothing to do with the PHP module that Apache loads. To get Apache to use a specific PHP module you need to adjust your Apache’s config file; httpd.conf or apache2.conf. More details here in this answer on where to look.

– JakeGould – 2019-01-29T15:05:35.743

Possible duplicate of Why is the PHP version different in phpinfo() and CLI?

– JakeGould – 2019-01-29T15:05:46.360

Answers

0

Check to see if you have the apache2 php7.2 config files on your system:

# ls /etc/apache2/mods-available

You'll probably see (among many files):

...
php5.6.conf
php5.6.load
php7.2.conf
php7.2.load
...

If the php7.2.conf and php7.2.load files are present, then you can:

# sudo a2dismod php5.6
# sudo a2enmod php7.2

And then restart apache, for example:

# sudo service apache2 restart

Katin

Posted 2019-01-29T14:58:51.810

Reputation: 1

More info in: https://superuser.com/a/971895/495739 by JakeGould

– Nikhil_CV – 2019-05-22T10:27:57.120