Welcome Guest, Not a member yet? Register   Sign In
Cron job
#1

[eluser]vinu[/eluser]
Hello All,

i am trying to run a cron using codeigniter.
using : php /home/user/public_html/accountinfo/index.php scheduler crontest

but it's not working. on same path if i run a test file php /home/user/public_html/accountinfo/test.php

it works. and if hit direct url http://mysite.com/accountinfo/index.php scheduler crontest

it also works for me.

please help.

Thank you !
#2

[eluser]cotsweb[/eluser]
I ran into this problem (at least it looks like the same problem) sometime ago setting up a cron job for Zen Cart.

If you run your php program directly as a cron job it won't have the right working directory and won't find your include files so it will fail. I suspect your test.php doesn't use other files which is why it works and index.php doesn't.

To avoid this you need to tell cron to change directory before invoking PHP to run the program, so your cron command should read
Code:
cd "public_html/accountinfo"; /usr/local/bin/php index.php

This works on my Hostgator account, your path to PHP maybe slightly different.

Remember to leave a space between your path to PHP and the program name, you are invoking PHP with the program name as a parameter

I hope this helps
#3

[eluser]vinu[/eluser]
Thank you for helping us.

but my index.php is running good if i am write some code for test on index.php it works.

i also give a space after index.php. but it not works for me. i also check the real path it's good.

i can't understand why it's happens. and direct url (http://mysite.com/accountinfo/index.php scheduler crontest) is works.
but cron url (php /home/user/public_html/accountinfo/index.php scheduler crontest) not work for me.

please help.

Thank you !

#4

[eluser]smilie[/eluser]
How does your scheduler looks like? It should be working; also according to userguide CLI it should be working.

Did you look into the logging? Set in config to log maximum and run it again from CLI.

Cheers,
Smilie
#5

[eluser]vinu[/eluser]
Thank you for Help.

one thing every thing is goes well i have checked it too many times.

is the cron work on shared hosting. or it can be some server issue there ?

please help.

Thank you !
#6

[eluser]smilie[/eluser]
I have honestly no idea what you have said in your last post Sad

Let me try again; when you execute:

php /path/to/file/file.php function param

what error do you receive? Where does your script go 'wrong'? Did you check PHP / Apache logs? Is CI logging enabled and do you have something in there?

Cheers,
Smilie
#7

[eluser]vinu[/eluser]
Hi,

when i run it to command line.
i see there url not found error (404 page error).

could you please help me on it.

thank you !





Theme © iAndrew 2016 - Forum software by © MyBB