I get this PHP Warning when accessing my fresh WordPress 3.4.1 install (Norwegian language).
Warning: fopen(URL_TO_MY_WORDPRESS_PAGE/wp-cron.php?doing_wp_cron=1341476616.7605190277099609375000): failed to open stream: Connection timed out in PATH_TO_MY_WP_FILES/wp-includes/class-http.php on line 923
This is of course with the WP_DEBUG
flag set to true
, as it’s running on a development server.
This happens intermittently, so it seems to be a problem with wp-cron
.
Is this likely an error in WordPress or something wrong on my server? Should I worry?
The server is a fresh Ubuntu Server 12.04 VM with the LAMP stack.
Google search shows I’m not the only one experiencing this. (See buffered/indexed versions of pages listed to see the actual errors.)
EDIT: I’m also getting this same PHP Warning on the front page. Could it be related to the fact that the webserver is being NATed to? Currently I’ve set up the firewall to point port 19235 to 80 on the development server.
The answer is apparently YES, I should worry. After some research, I’ve found that the warning seems to be related to misconfigurations on the server that WordPress is hosted on (ie. a problem with my server, not WordPress).
Common misconfigurations:
The problem in my case was actually caused by my firewall (pfSense), which has “Disable NAT reflection” by default (listed as common reason #2).
On the server itself, I tried to reach myself using telnet, and the result was as follows:
To fix this, I had to uncheck Disable NAT reflection on my firewall. In my case, this was in the web interface of pfSense under System->Advanced->Firewall/NAT.
Source: http://forum.pfsense.org/index.php?topic=3473.0
Now I can connect to myself (on the server itself) through the firewall just fine:
and I am no longer getting the PHP warning about wp-cron.
I figured this out after reading this detailed answer regarding
wp_cron
, explaining how it works.Source: http://wordpress.org/support/topic/scheduled-posts-still-not-working-in-282#post-1175405
As stated in this great and detailed post, if you have no control over your servers configuration or, if applicable, the environment – a workaround is to put
in your wp-config.php file.