Closed AndreiBarsan closed 12 years ago
Another notice - running it as /usr/bin/php "/home/xxx/www/index.php" admin cron produces the same result as when the script is ran by the cron daemon. Odd.
I can't get the CLI to work from ssh console, although the method does work from the URI
I'm executing the command using root user /usr/bin/php -f /file/path/to/project/index.php controller method but accessing the URI: http://localhost/controller/method does work
no error what so ever seen in logs or httpd log or mysql , the test method has very easy email() test function
if i managed to do syntax error into the method, i'll get PHP Parse error printed into the ssh console.
I don't know actually what is the reason.
Is that with 2.1 (works for me) or the current development code?
yes that does happen with CI 2.1.0
I'll create new empty project and check out of my current application, if it works then i must have something in my application that prevents it from working from CLI, although it works pretty well from URI and that is the strange part.
Just a guess, but - it's most likely to happen if you've extended the core Controller class. Another possibility is the Session library - if it's that, it's still a bug.
I have created empty project and the same test controller worked from CLI. by the way, I'm not extending the core controller class, I'll keep investigate about the issue and update here.
I was having issue with my code, it's not Codeigniter to blame, sorry .. now it works
OK ... @AndreiBarsan Can you check again as well?
I'm going through a very busy schedule right now, I'll post some more tests as soon as I can.
Did you have a chance to run those tests?
I've had this problem on a server running CentOS + cPanel.
In the command line I can use
php /path/to/index.php controller method
but in a cron I need to use
/usr/local/bin/php /path/to/index.php controller method
I don't know enough to know why it works like that, but maybe this will help someone else who has the same problem.
Because you don't have PHP directory in Linux $PATH variable so you can use it like that
php /path/to/index.php
use this command to look if there are exists "/usr/local/bin" path
echo $PATH
Hello, I am using CodeIgniter for a rather large commercial application, and I need to run an hourly cron to manage sending some mail. Pretty basic. I was using the bootstrapper posted on the wiki - http://codeigniter.com/wiki/Cron_job_bootstrapper, with the following cron command:
Worked like a charm. Now, I updated to the latest version of CodeIgniter, 2.1.0 and while browsing the documentation, I noticed that the bootstrap script was useless since it seemed to work easier, http://codeigniter.com/user_guide/general/cli.html by just calling
However, this does not work. When printing the output in my email, it just shows the HTML of the landing page, with no error message being displayed. I know it's not some sort of botched session code, since switching back to the old version works great and the proper log files are created by the script.
What's strange is that running this via the CLI through SSH works, and if I remove the security functionality, so does simply accessing site.com/admin/cron, which is strange.
I cannot put my finger on it - could it be a true CI bug, or a problem with crond?