skip to Main Content

I have updated my application server on centos 7.x with php 7.3.x which gives following error when i run console command like

/usr/local/zend/bin/php /var/www/html/cfms-hc/yii

Following is stack log.

        Exception 'yiibaseUnknownMethodException' with message 'Calling unknown method: yiiconsoleRequest::getHeaders()'

in /var/www/html/cfms-hc/vendor/yiisoft/yii2/base/Component.php:300

Stack trace:
#0 /usr/local/zend/var/plugins/yii2/zray/zray.php(158): yiibaseComponent->__call('getHeaders', Array)
#1 /usr/local/zend/var/plugins/yii2/zray/zray.php(43): Yii2->getInfo()
#2 /var/www/html/cfms-hc/vendor/yiisoft/yii2/base/Controller.php(157): Yii2->getPageInfo(Array, Array)
#3 /var/www/html/cfms-hc/vendor/yiisoft/yii2/console/Controller.php(164): yiibaseController->runAction('', Array)
#4 /var/www/html/cfms-hc/vendor/yiisoft/yii2/base/Module.php(528): yiiconsoleController->runAction('', Array)
#5 /var/www/html/cfms-hc/vendor/yiisoft/yii2/console/Application.php(180): yiibaseModule->runAction('', Array)
#6 /var/www/html/cfms-hc/vendor/yiisoft/yii2/console/Application.php(147): yiiconsoleApplication->runAction('', Array)
#7 /var/www/html/cfms-hc/vendor/yiisoft/yii2/base/Application.php(386): yiiconsoleApplication->handleRequest(Object(yiiconsoleRequest))
#8 /var/www/html/cfms-hc/yii(20): yiibaseApplication->run()
#9 {main}

Exception 'yiibaseUnknownMethodException' with message 'Calling unknown method: yiiconsoleRequest::getHeaders()'

in /var/www/html/cfms-hc/vendor/yiisoft/yii2/base/Component.php:300

Stack trace:
#0 /usr/local/zend/var/plugins/yii2/zray/zray.php(158): yiibaseComponent->__call('getHeaders', Array)
#1 /usr/local/zend/var/plugins/yii2/zray/zray.php(43): Yii2->getInfo()
#2 /var/www/html/cfms-hc/vendor/yiisoft/yii2/base/Controller.php(157): Yii2->getPageInfo(Array, Array)
#3 /var/www/html/cfms-hc/vendor/yiisoft/yii2/console/Controller.php(164): yiibaseController->runAction('', Array)
#4 /var/www/html/cfms-hc/vendor/yiisoft/yii2/base/Module.php(528): yiiconsoleController->runAction('', Array)
#5 /var/www/html/cfms-hc/vendor/yiisoft/yii2/console/Application.php(180): yiibaseModule->runAction('', Array)
#6 /var/www/html/cfms-hc/vendor/yiisoft/yii2/console/Application.php(147): yiiconsoleApplication->runAction('', Array)
#7 /var/www/html/cfms-hc/vendor/yiisoft/yii2/base/Application.php(386): yiiconsoleApplication->handleRequest(Object(yiiconsoleRequest))
#8 /var/www/html/cfms-hc/yii(20): yiibaseApplication->run()
#9 {main}`enter code here`

I can not understand where to look and what can be the problem. Plz guide anyone.

2

Answers


  1. Chosen as BEST ANSWER

    I was using Zend Server for and just disabled Zray on it. Problem solved


  2. The error is because you are importing and using the wrong Request class:

    yiiconsoleRequest::getHeaders();
    

    Look at the console, console does not have the getHeaders() method..

    You must use:

    yiiwebRequest::getHeaders();
    

    https://www.yiiframework.com/doc/api/2.0/yii-web-request#getHeaders()

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search