Making postie work with cron jobs, fails with wp-config.php outside of web root
I use the excellent Postie plugin to post to this blog via email. I’ve been battling for days to get it to automatically check the mailbox for new message though, and while I still haven’t got it working using WP-Cron (WordPress’ “pseudo-cron”), I’ve finally managed to get it working via a direct cron job.
What didn’t work : any form of call to wp-content/plugins/postie/get_mail.php when my wp-config.php file was one directory up from the root of my wordpress directory (a security enhancement). I was getting errors like this:
PHP Fatal error: require_once(): Failed opening required ‘/home/funkypenguin/wp-settings.php’
(include_path=’.:/usr/share/pear:/usr/share/php’) in /home/funkypenguin/wp-config.php on line 79
Once I moved wp-config.php back into the web root directory, I got happy messages like this instead:
[Wed May 14 22:10:04 2014] [error] [client 2407:1000:1:7::161:79] Postie: Starting mail fetch [Wed May 14
22:10:04 2014] [error] [client 2407:1000:1:7::161:79] Postie: Postie is in
/home/funkypenguin/public_html/wp-content/plugins/postie
Since I can no longer locate wp-config out of the web-accessible portion of my directory structure, I added the following to .htaccess instead:
{% highlight conf %}
order allow,deny deny from all
{% endhighlight %}