Wordpress Error

February 18, 2013 4k views
Hello, I have a droplet setup correctly running wordpress with Linux, nginx, MySQL, PHP (LEMP) stack on Ubuntu 12.10 X64 Server. I got the following error in wordpress. Warning: fopen(http://example.com/wordpress/wp-cron.php?doing_wp_cron=1361221148.57854199409284738473):failed to open stream: HTTP request failed! in /var/www/example.com/public_html/wordpress/wp-includes/class-http.php on line 921 Is this cron job related? If so how do i setup a cron job for wordpress, does it need one?
4 Answers
it looks like wordpress has its own internal cron job but it's unable to access that file. Have you tried to access the HTTP url manually to see what error word press is getting?
Thanks dave,

Yes you are correct. I added permissions to the wordpress directory to allow my ftp user to edit files in filezilla but that changed my permissions i had previously set for wordpress.

The solution:
sudo chown -R www-data:www-data /var/www/example.com/public_html/wordpress

For reference, WordPress has it's own internal CRON system which is fired off when visitors access your site. This is how scheduled posts are regulated. The same applies to [insert item] if it's on a schedule (i.e. backups, etc).

Normally when you see "doing_wp_cron" in the URL or error log, it's due to the internal CRON being unable to run, or, you've disabled the internal CRON in favor of an external (i.e. crontab -e or through your control panel GUI).

The downside, the internal CRON is fired off for each visitor, which can stress a server on larger sites. Just an FYI, if you're running a large installation with quite a few visitors hitting the site at all hours of the day, an external CRON run may be better. That just from experience working with sites that continually see hundreds of thousands of [unique] visitors a month. On smaller installations it's fine and really won't do much harm, especially if you have your own VPS.
Thank you Jonathan. I will have to setup an external CRON.
Have another answer? Share your knowledge.