Search code examples
phpapachedrupalwebserverdrupal-8

Drupal 8 installation setup shows older PHP version than what the server is running


When installing Drupal 8, just before database setup, I get a few errors and warnings, but I also see the following:

PHP

7.1.14-1+ubuntu16.04.1+deb.sury.org+1

However, doing php -v I get:

PHP 7.2.2-3+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Feb  6 2018 16:11:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.2-3+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Clearly, my web server is running 7.2 but Drupal thinks it's 7.1. This is causing a problem where I have gd installed on PHP 7.2, but Drupal doesn't see gd installed on PHP 7.1 (because it isn't, at least its php.ini file doesn't have the gd extension enabled). Same with a few of the other errors and warnings.

How can I get Drupal 8 to recognize the correct PHP version?


Solution

  • So I figured it out:

    Runing sudo a2dismod php7.1 then sudo a2enmod php7.2 seems to work perfectly (after a restart of Apache).