Newsletter Internals

This page is dedicated to who need to understand better the Newsletter code or explore options not available on configuration panels. Developer skills required.

See the Developers area for more tech documentation.

Max execution time

PHP has a setting which indicates the maximum number of second a script can run before it will be killed (because considered runaway). What happens if Newsletter (o any other plugin) starts a loop (read “the delivery loop”) which consumes more than the max execution time of PHP?

PHP will kill the script. Hence Newsletter internally takes in account that value and stop itself if the consumed time is approaching the max execution time.

The PHP limit can be changed on the fly, and WordPress does it from time to time in the code. The function to use is set_time_limit().

But there is a “possible” problem in changing this value. When PHP runs as CGI or FastCGI, the cgi controlled can kill the running script if it get over the cgi timeout. If setting the PHP max execution time on the fly we go over the cgi timeout, the script could be killed anyway.

That consideration should not apply when PHP runs as Apache module, usually on dedicated server. For shared hosting PHP always runs as cgi.

Bye the way, if you know what you’re doing, you can ask Newsletter to change the PHP time limit setting the constant NEWSLETTER_MAX_EXECUTION_TIME to an integer value representing the timeout in seconds. Add this constant to your wp-config.php file.