CakePHP Walking Console Godaddy

I tried my best to get my CakePHP website working on the Godaddy grid hosting account. My pie application is an installation hosted from a subdirectory in my account and accessed through a subdomain. I had to configure my .htaccess files to get this to work, and now I need the CakePHP console to work in this environment.

I have the same setup for cake apps on an Ubuntu server hosted on Amazon EC2. Essentially, this is a simple Ubuntu LAMP installation. The CakePHP console works as expected in this environment.

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

CakePHP console: this file is loaded incorrectly and cannot continue.Please make sure / cake / console is on your system path and check the manual for the correct use of this ( http://manual.cakephp.org/ )

I started adding debugging code to cake / console / cake.php to find out what was going on. On godaddy, when I echo from print_r($this->args) on line 183, I find that the array is empty. When I do this on my Ubuntu EC2 instance, I get the following:

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

It seems that the godaddy PHP command line does not go through the bash shell command line arguments. Does anyone have any tips on how I can use the CakePHP console to work with Godaddy?

The bash script that invokes the Cake wrapper contains the following

 LIB=${0/%cake/} APP=`pwd` exec php -q ${LIB}cake.php -working "${APP}" "$@" exit; 

I think changing this script may solve the problem.

+7
linux bash php cakephp
source share
3 answers

I don't think that editing anything in lib / cake is fine, as it will disappear from your first pie update.

Rather, I changed the register_argc_argv parameter to php.ini, adding the line:

 register_argc_argv=On 

Everything seems to be working with me now.

+1
source share

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

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

to

 exec php -q -d register_argc_argv=1 ${LIB}cake.php -working "${APP}" "$@" 

after that I found out that php calling, how it happened, runs PHP 4 CLI. to fix this, here is the final bash script that I use to call PHP 5 on my shared Godaddy hosting

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

if you are setting up a php-based cron job through your hosting control panel, you will find that the php command invoked actually matches this php5 executable.

+12
source share

"Make sure / cake / console is on your system path."

This is a hosting grid, so I assume that you have a .bashrc file that you can edit. First you need to know the absolute path to your cake subdirectory, and then use vim or nano to edit your .bashrc

PATH = $ PATH: / absolute / path / to / cake / console

You can then log out and log in, and you should be able to type cookies from anywhere, and it should fix the error you received (run it from the application directory so that it can find your database.php file).

Otherwise, you can temporarily export the .bashrc file, but you will need to enter it every time you log in.

+1
source share

All Articles