Php console fails with php 7.1.5

Hello
I am using piwik 3.1.1 with php 7.1.5 and Zend Engine 3.1.0. I have installed extensions mysqli, pdo_mysql, ctypes, simplexml and compiled with session

When i try to launch php console core:update (or visitorgenerator:generate-visits … for exemple), it fails directly with this message :

Piwik and Zend_Session require the session extension
 
It appears your PHP was compiled with --disable-session.
To enjoy Piwik, you need PHP compiled without that configure option.
Piwik requires the php5-json extension which provides the functions json_encode() and json_decode()
 
It appears your PHP has not yet installed the php5-json extension.
To use Piwik, please ask your web host to install php5-json or install it yourself, for example on debian system: sudo apt-get install php5-json.
Then restart your webserver and refresh this page.

Any idea about this issue ?

Hi,

This error definitly means that the json php extention is missing.

But I am not sure why the latter error is appearing.

Hi
Thanks for your reply. Json extension is installed (by default), I can see it in phpinfo(). The quoted error message seems not correspond to php installation… Ask for php5-json in 7.1.5 php version ?

Regards

Same issue here with PHP7.2.9 and json extension installed.

Any ideas?

Please show output of following commands:

which php
php -v
php -m

php -v
PHP 7.2.9 (cli) (built: Sep 1 2018 21:29:50) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright © 1998-2018 Zend Technologies
with the ionCube PHP Loader v10.1.1, Copyright © 2002-2017, by ionCube Ltd.

php -m
[PHP Modules]
apcu
calendar
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
gettext
hash
iconv
imagick
imap
intl
ionCube Loader
json
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcre
PDFlib
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]
the ionCube PHP Loader

You could try to hardcode your php 7.2 binary into the console file. By default it uses /usr/bin/env to guess the correct binary and it seems like, this does not work for you.

So run which php copy the given path and replace the /usr/bin/env php shebang in the first line of the console with the path.

Funny quote for this problem:

The advantage of #!/usr/bin/env python is that it will use whatever python executable appears first in the user’s $PATH .

The disadvantage of #!/usr/bin/env python is that it will use whatever python executable appears first in the user’s $PATH .

So Matomo is working on PHP7.2 in general? Or might it be some plugin which causes this error? If I look into the Matomo System requirements, I only see minimum values, no maximum values. And Matomo is working fine on PHP7.1 or 7.0 on the same server.

Hi,

I am using Matomo with 7.2 for about 6 months without issues.

okay. so how do we fix this? It appears your PHP has not yet installed the php5-json extension.