Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yii2: Unable to determine the entry script file path - change PHP server environment from cgi to cli

I'm using yii2 basic template for my application. I created a console command which executed successfully on my local. But when I run it in terminal on my bluehost site, I got this error "Exception 'yii\base\InvalidConfigException' with message 'Unable to determine the entry script file path.'"

I learn that the issue was about the php environment, that uses cgi instead of cli, got the info here https://github.com/yiisoft/yii2/issues/6244

I confirm it when checking the php -v host: PHP 5.4.34 (cgi-fcgi) (built: Oct 21 2014 17:19:35) local(dev): PHP 5.5.14 (cli) (built: Sep 9 2014 19:09:25)

How I can change this server environment to use cli instead of cgi. A step by step guide with bluehost environment would be appreciated.

like image 570
Pelang Avatar asked Dec 02 '22 17:12

Pelang


2 Answers

You're trying to run console command with PHP CGI, which have different environment.

You should use PHP CLI, so call php-cli instead of php.

like image 74
Anton Oliinyk Avatar answered Dec 06 '22 10:12

Anton Oliinyk


Solve my same problem with

/usr/local/bin/php /home/xyz/yii hello
like image 25
Ali Yousefi Avatar answered Dec 06 '22 11:12

Ali Yousefi