So, here is a little info on my setup. Running Centos with apache and php 5.2.17. I have a website that lists products from many retail sites. I have scanner scripts that run to capture products from each website. Because each site is different, each script crawler must be configured to crawl a particular retail website. So basically I have 1 tracked move per seller. At this time, I have 21 scanners that are constantly working to collect and update products from these sites. Each crawler is a php file, and after the PHP script is executed, it checks to make sure that it is the only instance itself, and at the very end of the script, it uses exec to start all over again, while the original instance is closed. This helps protect against memory leaks as each crawler restarts before it closes. However, lately I will check the scanner scripts and notice that one of them no longer works, and in the error log I found the following.
PHP Warning: exec() [<a href='function.exec'>function.exec</a>]: Unable to fork [nice -n 20 php -q /home/blahblah/crawler_script.php >/dev/null &]
This is what this particular crawler should start again, but since it was "incapable", it never restarted, and the original crawler instance ended as usual.
Obviously, this is not a resolution problem, because each of these 21 crawler scripts runs this exec command every 5 or 10 minutes at the end of its launch, and most of the time it works as it should. It seems to happen once or twice a day. It seems that its limit is of some degree, as I just recently began to see that this has been happening since I added my 21st seeker. And its not always the same crawler that gets this error, there will be any of them at a random time that will not be able to unlock the exec restart command.
Does anyone have an idea what could cause php to be unable to develop, or perhaps even a better way to handle these processes in order to get around the error all together? Is there a limit to the process I have to learn, or something like that? Thank you in advance!
php centos
Dane landan harvey
source share