My WordPress site was failing to run scheduled tasks. I went through wp-cron.php and found that commenting-out the following if-statement resolved the problem:
if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) {
if ( ! headers_sent() ) {
header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
}
fastcgi_finish_request();
}
My guess is that using Unit as an application server, rather than FastCGI, causes problems for this code.
Can someone tell me if this is correct? Why does running this function stop execution of the rest of the script? Is it safe to comment-out this statement, or should I make some different change to workaround this?
thanks
From what I've seen there is no workaround to run
wp-cron.phpthrough aGETrequest, except commenting those lines.However, you can run wp-cron.php by running
php /path/to/wordpress/wp-cron.phpfrom your command line, or setting a system cron (for example, every 10 minutes):