emails being piped php script through cpanel email user filtering, php script have execution time limit (to prevent dos). when time limit error occurs, email bounces.
althought php error producing bouncing, error virtually cannot fixed, why there time limit.
a sample of bounce message is:
this message created automatically mail delivery software.
a message sent not delivered 1 or more of recipients. permanent error. following address(es) failed:
pipe |/usr/bin/php -q /home/foo/bar/script.php
generated moo@beer.cl
local delivery failed------ copy of message, including headers. ------
------ body of messa[...]
the first thing 1 might think, execution time limit error printing message (that automatically cause bounce) not case, because ini_set('display_errors', false);
set. proof nothing being printed the lack of "the following text generated during delivery attempt: ..." in message quoted above.
a small test:
#!/usr/bin/php -q <?php set_time_limit(1); ini_set('display_errors', false); $fh_stdin = fopen('php://stdin', 'rb'); while (true) rand(); ?>
not sure if there question here, mail processor bounces message because when php script terminates abnormally due error, php process returns non-zero value (255 in case) shell.
when mta piped email script sees fails based on return value being > 0, considers failure , bounces message (potentially including script output in bounce message).
if can't (or don't want to) change max execution time these piped processes, 1 solution queue message processing other script can break down processing pieces or increase time limit.
using register_shutdown_function()
, set_error_handler()
unable override php's return value timeout using exit(0)
won't workaround.
you should able increase time set_time_limit
unless php running in safe mode preventing doing so. if processes long running may better queue messages processing instead of trying handle messages come in since lead bottlenecks or server overloads.
Comments
Post a Comment