0

i've a php script(call it file1) which i've scheduled as a cronjob...this script calls another php function in another php file(file2)......now what happens is for some unknown reason, this function executes twice (i.e. file1 calls function from file2)......

can anyone tell what could be the reason and what can be the solution...what i think is its some sort of OS/threads related issue but your expert opinion is more valueable...

thanks

2
  • 6
    It'll be tough to solve this without seeing some code. Commented May 6, 2011 at 13:15
  • This is nothing to do with multi-threading - and I'll give you odds of 100:1 its a bug in your code. Commented May 6, 2011 at 15:33

1 Answer 1

2

Hard to be able to tell much without seeing your code (and possibly the cron config as well), but my guess would be that either you're calling the function twice in your program without realising it or else your cron config is causing the program to be run twice

You could try outputting the PID using the getmypid() function at various places in your two bits of PHP code; this will help you determine which process invoked each call to the function, and will probably help you see which of the above scenarios (or something entirely different) is actually happening.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.