Home » Php » php – CakePHP Console on Godaddy Hosting

php – CakePHP Console on Godaddy Hosting

Posted by: admin July 12, 2020 Leave a comment


I have been struggling to get my CakePHP site working on a Godaddy “grid hosting” account. My cake app is setup is hosted from a subdirectory on the account, and can be accessed via a subdomain. I had to adjust my .htaccess files to get this working, and now I need to get the CakePHP console working in this environment.

I have the same cake application setup on an Ubuntu server which is hosted on Amazon’s EC2 service. Basically a plain out of the box Ubuntu LAMP setup. The CakePHP console works as expected in this environment.

When I try to run the console on Godaddy I get the following message:

CakePHP Console: This file has been loaded incorrectly and cannot
continue.Please make sure that /cake/console is in your system
path,and check the manual for the correct usage of this

I’ve started to add in some debugging code in cake/console/cake.php to find out what’s going on. On the godaddy site, when I echo out print_r($this->args) at line 183 I find the array is empty. When I do this on my Ubuntu EC2 instance I get this:

    [0] => /var/www/www.directory.sdcweb.org/htdocs/cake/console/cake.php

It looks like godaddy’s command-line PHP isn’t passing through the bash shell command line arguments. Does anybody have some advice as to how I might get the CakePHP console working on Godaddy?

The bash script which invokes the Cake shell contains the following


exec php -q ${LIB}cake.php -working "${APP}" "[email protected]"


I am thinking that modifying this script may solve the problem.

How to&Answers:

I don’t think editing anything in the lib/cake is okay, since it will be gone with your first cake update.

Rather, I changed the register_argc_argv setting from the php.ini by adding the line:


All seems to work now with me.


in the cake shell script (cake/console/cake) change

exec php -q ${LIB}cake.php -working "${APP}" "[email protected]"


exec php -q -d register_argc_argv=1 ${LIB}cake.php -working "${APP}" "[email protected]"

after this I found out that calling php like this happened to run the PHP 4 CLI. to fix this here is the final bash script that I am using to invoke PHP 5 on my shared Godaddy hosting

exec /web/cgi-bin/php5 -q -d register_argc_argv=1 ${LIB}cake.php -working "${APP}" "[email protected]"

if you setup a php-based cron job through their hosting control panel, you will find the php command invoked is actually to this php5 executable.


“Please make sure that /cake/console is in your system path.”

This is grid hosting so I’m assuming you have a .bashrc file which you can edit. First you need to know the absolute path to your cake sub-directory then use vim or nano to edit your .bashrc


Then you can log out and log back in and you should be able to type cake bake from anywhere and it should fix the error your getting (run it from your app directory so it can find your database.php).

Failing a .bashrc file you can export the variable temporarily but you will have to type it every time you log in.