# Crontab PHP scripts not ending

**URL:** <https://community.unix.com/t/crontab-php-scripts-not-ending/249451>\
**Category:** Shell Programming and Scripting\
**Created:** [September 16, 2009, 1:11pm UTC](https://community.unix.com/t/crontab-php-scripts-not-ending/249451 "2009-09-16T13:11:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitrous](https://community.unix.com/letter_avatar/nitrous/32/6_449c533f586939b6e5f246632a46421f.png) [@nitrous](https://community.unix.com/u/nitrous)\
**Post date:** [September 16, 2009, 1:11pm UTC](https://community.unix.com/t/crontab-php-scripts-not-ending/249451/1 "2009-09-16T13:11:19Z")

</div>

when i run the scripts from command line like

php ./file.php they run fine and it ends.

But i have them running in crontab every 5 minutes and they sometimes dont close. Can i write something to log why or force them to close after a certain amount of time by killing the pid?

---

<div class="post-metadata">

**Author:** ![Corona688](https://community.unix.com/letter_avatar/corona688/32/6_449c533f586939b6e5f246632a46421f.png) [@Corona688](https://community.unix.com/u/Corona688)\
**Post date:** [September 16, 2009, 3:30pm UTC](https://community.unix.com/t/crontab-php-scripts-not-ending/249451/2 "2009-09-16T15:30:59Z")

</div>

You might be able to use strace to see if they're waiting on a system call of some sort. And php has the function [set-time-limit()](http://ca3.php.net/manual/en/function.set-time-limit.php). As for why it's doing this, I can't tell without seeing the code.

---

<div class="post-metadata">

**Author:** ![nitrous](https://community.unix.com/letter_avatar/nitrous/32/6_449c533f586939b6e5f246632a46421f.png) [@nitrous](https://community.unix.com/u/nitrous)\
**Post date:** [September 16, 2009, 5:29pm UTC](https://community.unix.com/t/crontab-php-scripts-not-ending/249451/3 "2009-09-16T17:29:46Z")

</div>

thank you that helps me out at lot
