php bin/magento An exception was raised while creating “Request”; no instance returned Magento 2

Check PHP version first :

php -v

PHP 7.3.3-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Mar  7 2019 20:31:26) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.3-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
equaltrue@server:~/domains/demo.equaltrue.com/public_html/m2/wc/ms230$

Cause: in my case, my Magento 2 version does not support PHP 7.3 so I have to give a compatible version for it. One thing is important is CLI per version error not default PHP version that you will find by phpinfo(); a method

Let’s check which PHP version is given in my server

go to /usr/bin

search for php* file in my case i already install multiple php on there

cd php
php         php7.0      php7.1      php7.3      php-cgi     php-cgi7.0  php-cgi7.

so I will change PHP version php7.3 to php 7.1

sudo update-alternatives --set php /usr/bin/php7.1
php -v
PHP 7.1.27-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Mar  7 2019 20:02:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.27-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.