phpcgicommand-line-interfaceyii2bluehost

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.


Solution

  • 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.