开发者

PHP script launching multiple times

开发者 https://www.devze.com 2023-01-13 20:07 出处:网络
I have a PHP script that launches another script in the background. Recently my host upgraded PHP and this pair relaunches the background script multiple times a second where it should only be launchi

I have a PHP script that launches another script in the background. Recently my host upgraded PHP and this pair relaunches the background script multiple times a second where it should only be launching once.

I reduced the two scripts to their most basic form and they still have the problem.

start.php:

<?php exec("/home/s*****/public_html/sandbox/process/pushupdate.php &"); ?>

and pushupdate.php:

#!/usr/bin/php -q
<?php mail('********开发者_C百科*@gmail.com', 'test output', 'testing'); ?>

The email never gets sent, but that may be a problem with my hosting company.


Do your host allow cronjobs? If yes, use them instead of calling pushupdate.php from another PHP script. You'll solve two problems: if no-one is visting your site, your mail queue will still be processed. If your site is busy, there won't be unnescessary calls to pushupdate.php

A possible cause is a redirect, e.g. example.com to www.example.com.

start.php is called by the visitor, right?

0

精彩评论

暂无评论...
验证码 换一张
取 消