|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27486 PHP Warning: system(): Unable to fork
Submitted: 2004-03-03 18:35 UTC Modified: 2004-03-10 19:52 UTC
Avg. Score:4.3 ± 0.9
Reproduced:7 of 7 (100.0%)
Same Version:1 (14.3%)
Same OS:1 (14.3%)
From: donny at intercosmos dot com Assigned:
Status: No Feedback Package: CGI/CLI related
PHP Version: 4.3.4 OS: Linux 2.6.2 /Fedora Core 1,
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: donny at intercosmos dot com
New email:
PHP Version: OS:


 [2004-03-03 18:35 UTC] donny at intercosmos dot com
We started using a new program that spawns additional CLI php scripts recently.  And today, we started getting stuff like this:

PHP Warning:  system(): Unable to fork [/usr/bin/php /www/htdocs/onetime/spawn_domain.php '' > /dev/null &] in /www/htdocs/onetime/spawn_domain_parent.php on line 39

Now if I wait a few minutes, and restart the parent it will normally go on about it's business.  But then after a while it will all of a sudden no longer be able to spawn new children.

All of the other bugs mentioned like this are based on Windows, but this is a Linux box.

Reproduce code:
		system("/usr/bin/php /www/htdocs/onetime/spawn_domain.php '$db[domain]' > /dev/null &");

Expected result:
It should spawn a child CLI program and run.

Actual result:
It runs the code mentioned above.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-04 03:29 UTC]
What does that new program that spawns these children do? Is it a long living process?
 [2004-03-04 09:56 UTC] donny at intercosmos dot com
Quick explanation.
1.  Parent Program, grabs a list of 25 domains, and then spawns off 25 children to process the domain.  The parent does a mysql get lock on the domain, and once the child process is done, it tells mysql to release the lock which tells the parent the child is finished.  Once all 25 domains are finished the parent spawns a new instance of itself and the original parent exits.
2.  The child programs in certain cases can spawn children of their own, but never more than 1 or 2 children.  This keeps the code small and effecient.

Hope this makes sense.
 [2004-03-05 18:57 UTC]
The only thing I can think of is that you're running out of filehandles on your system. Can you try raising the limit and see if this fixed it? (or makes it run longer correctly) Please make also sure that you always close sockets when running in a deamon mode like this. 

Perhaps you can put up a short reproducing script as well? (Without any use of external resources then)

 [2004-03-10 19:52 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 22 13:01:29 2024 UTC