Command line shows extension "gd" is enabled but WordPress says it isn't. Terminal and phpinfo() showing different PHP versions

0

php -v is showing 5.5.9 phpinfo() is showing 5.6.22.

WordPress is reporting that I have to enable either gd or imagic extension in order work with image processing.

The Configure command for phpinfo() shows the following:

'./configure' '--cache-file='''/home/subrara/.phpbrew/cache/config.cache'''' '--prefix=/home/subrara/.phpbrew/php/php-5.6.22' '--with-config-file-path=/home/subrara/.phpbrew/php/php-5.6.22/etc' '--with-config-file-scan-dir=/home/subrara/.phpbrew/php/php-5.6.22/var/db' '--disable-all' '--enable-session' '--enable-short-tags' '--with-zlib=/usr' '--with-libdir=lib/x86_64-linux-gnu' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-curl=/usr' '--enable-json' '--with-gd=shared,/usr' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-freetype-dir=/usr' '--enable-ftp' '--with-apxs2=/usr/bin/apxs2' '--enable-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--with-libxml-dir=/usr' '--enable-opcache' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--enable-cli' '--enable-ctype' '--enable-dom' '--enable-fileinfo' '--enable-filter' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-mbregex' '--enable-mbstring' '--with-mhash=/usr' '--with-mcrypt=/usr' '--enable-pcntl' '--with-pcre-regex' '--with-pcre-dir=/usr' '--enable-pdo' '--enable-phar' '--enable-posix' '--with-readline=/usr' '--enable-sockets' '--enable-tokenizer' '--with-openssl=/usr' '--enable-zip' '--with-pear=/home/subrara/.phpbrew/php/php-5.6.22/lib/php'

I didn't understand much of the above.

From terminal (Ubuntu 14.04), when I am running sudo apt-get install php5-gd, it says

php5-gd is already the newest version.

As far as I know, the phpinfo() version is the one I should consider while running any PHP / WordPress site, and seems like I need to install and enable these extensions for 5.6.22, but I don't know how!

The output of php -i | grep 'GD\|ImageMagick' is:

GD Support => enabled
GD Version => 2.1.1-dev
GDM_LANG => en_US
GDMSESSION => ubuntu
_SERVER["GDM_LANG"] => en_US
_SERVER["GDMSESSION"] => ubuntu

In this situation, how can I enable gd and imagic extensions for version 5.6.22?

EDIT:
Is this possible to install php7 with required extensions and use it? Will this create any trouble running websites build in localhost?

Niladri Sarkar

Posted 2019-08-13T06:11:22.877

Reputation: 111

It might be that you have both php-fpm and php-cgi installed, hence the two different versions. Which distro and version are you using? – Dmitry Ponkin – 2019-08-13T11:30:54.497

output of lsb_release -a: Distributor ID: Ubuntu. Description: Ubuntu 14.04.6 LTS. Release: 14.04 – Niladri Sarkar – 2019-08-13T11:42:21.897

No answers