Welcome to WebmasterWorld Guest from

Forum Moderators: bakedjake

Message Too Old, No Replies

php script limitations for cron job execution

are there any?



4:37 pm on Oct 9, 2006 (gmt 0)

10+ Year Member

I guys,
Through my plesk control panel I'm able to set up cron jobs to execute simple php scripts that send emails etc without any problems.

But I've recently had a programmer write a php script that is reading an external xml file into my database and it just isn't executing with my cron job.

If I trigger the php file through IE it runs no problem.

So I'm wondering are their any limitations in php if it is executed through a cron tab?

I was thinking script size?
database calls?
reading external xml files?

As you can probably tell I'm not the programmer but without any cue I'm kind of stuck between my host and programmer who are blaming each other.



5:39 pm on Oct 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Does the script use sessions? Open it up and look for $_SESSION. Also it could have to do with the permissions on the external file, try setting those to make sure the username you run the cron job from has read access.


6:10 pm on Oct 9, 2006 (gmt 0)

10+ Year Member

thanks for those tips.
unfortunately there are no sessions and the external file (I've been told) is allowing us to read it.

I should add I just upgraded to php5 I don't know if that makes a difference.


10:02 pm on Oct 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Does it require input arguments like mypage.php?a=1&b=2


5:55 am on Oct 10, 2006 (gmt 0)

10+ Year Member

the xml feed comes in from a url like this
<? set_time_limit(0);


9:04 am on Oct 10, 2006 (gmt 0)

10+ Year Member

If a process doesn't work, it needs to be debugged.

You may look (or let your programmer look) at these things systematically:

-- did the program start at all: is everything spelled correctly in the crontab? (possible errors: wrong or incomplete path, the cron job may have a different environment than you, so the path to the script should be specified completely as /path/from/root/to/script).
-- Could the program find the external xml file? (possible errors: wrong or incomplete path, see above; to be fixed either in the cron statement if specified as argument, or within the program if hardcoded there)
-- Could the program read the file? (possible error: insufficient file permissions, the cron job may run under another user context than you locally)
-- Could the database be connected (there always is a database return codes for this)?
-- was the SQL accepted (again a database return code)?
-- are there other things to note?

Kind regards,


Featured Threads

Hot Threads This Week

Hot Threads This Month