user2505513
user2505513

Reputation: 333

CodeIgniter cron job command line error

My hosting package (Cloud Next) actually includes scheduled tasks as standard with a testing facility and instructions for setting up a new task.

My question is whether or not I am using correct command line:

/usr/bin/php /home/sites/mydomain.com/public_html/index.php update home

My update script url is: http://www.mydomain.com/admin/update - however, I use subfolders for my controllers, therefore (with routing) my controller is found in ...application/controllers/admin/update.php so my controller is "update" and my method is "home".

Testing the above command line returns the following:

"Your script returned the following: X-Powered-By: PHP/5.3.27

Content-type: text/html

welcome"

It's definitely NOT executing the script as required... The fact the word "welcome" is returned makes me think it's not factoring in the controller and method parameters.

Upvotes: 0

Views: 1815

Answers (3)

xiidea
xiidea

Reputation: 3394

Use this:

/usr/bin/php /home/sites/mydomain.com/public_html/index.php admin/update home

Enjoy!

You can read reference document about Running via the CLI from codeigniter here

Upvotes: 0

RayZor
RayZor

Reputation: 665

I had a similar problem - try this

/usr/local/bin/php /home/sites/mydomain.com/public_html/index.php admin update home

Not sure about the subfolder routing so try it with and without the admin, but the problem I had with it ignoring the call to the controllers and returning the default welcome message was fixed by using /usr/local/bin/php

Upvotes: 1

Andrew
Andrew

Reputation: 5340

Try:

/usr/bin/php /home/sites/mydomain.com/public_html/index.php admin update home

Upvotes: 1

Related Questions