note 31396 added to ref.exec

From: Date: Sun, 20 Apr 2003 14:17:01 +0000
Subject: note 31396 added to ref.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-46841@lists.php.net to get a copy of this message
If you want to execute background processes from PHP that should run indefinitely, be aware of the following nasty behavior (confirmed with PHP 4.3.1 under FreeBSD, but probably under other flavors of UNIX, too): PHP internally calls setitimer(2) to set the profiling interval timer (ITIMER_PROF) to enforce execution time limits (max_execution_time and max_input_time). These timer values are passed down to all processes executed by PHP. This means that after such a process has consumed [max_execution_time] seconds of CPU time (not wallclock time!), the system will send it a SIGPROF (signal 27). Since most processes don't use this signal and as such don't call signal(3) to catch or ignore it, the default action is executed, which is to terminate the process. So if you see background processes that were executed from PHP dying at seemingly random times, you may be experiencing this issue. The solution is simply to call set_time_limit(0) just before executing the process. -- http://www.php.net/manual/en/ref.exec.php http://master.php.net/manage/user-notes.php?action=edit+31396 http://master.php.net/manage/user-notes.php?action=delete+31396 http://master.php.net/manage/user-notes.php?action=reject+31396

« previous php.notes (#46841) next »