the0ther the0ther - 3 months ago 32
Linux Question

CakePHP Console on Godaddy Hosting

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
command.(http://manual.cakephp.org/)


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:

Array
(
[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

LIB=${0/%cake/}
APP=`pwd`

exec php -q ${LIB}cake.php -working "${APP}" "$@"

exit;


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

Answer

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:

register_argc_argv=On

All seems to work now with me.

Comments