WhyChooseBob
Forum Replies Created
-
Forum: Alpha/Beta/RC
In reply to: PHP Warning on Cron Run in wp_mailThat’d definitely fix it. I can’t seem to find where it’s documented that you’re supposed to run wp-cron from crontab through curl/wget, though. The most I can see is the top comment within wp-cron.php itself, which doesn’t even say to do so:
/** * WordPress Cron Implementation for hosts, which do not offer CRON or for which * the user has not set up a CRON job pointing to this file. * * The HTTP request to this file will not slow down the visitor who happens to * visit when the cron job is needed to run. * * @package WordPress */(Since the HTTP sentence talks about ‘the visitor’, I assumed that was only meant for when wp-cron isn’t set up to run from crontab).
Doing a bit more searching, it seems I’m not the only one thinking that using SERVER_NAME is not the best option: http://core.trac.ww.wp.xz.cn/ticket/25239.
Forum: Alpha/Beta/RC
In reply to: PHP Warning on Cron Run in wp_mailTo me, it doesn’t seem like a setup problem. I’ve never known PHP to set variables that it doesn’t know about (SERVER_NAME is given to PHP by Apache, as far as I know). The cron job is not being run through Apache, so PHP isn’t told about SERVER_NAME.
(To make sure we’re on the same page, when I say cron job I mean the unix crontab – my crontab line is
0 0,12 * * * php -q /.../path/to/dev/wp-cron.php).I ran my little
print_r($_SERVER);script on another server I have access to (non-cPanel, different version of PHP, and not related to my main server in any way), and got:Array ( [SHELL] => /bin/sh [USER] => <USER> [PATH] => /usr/bin:/bin [PWD] => /.../path/to/account/home [SHLVL] => 1 [HOME] => /.../path/to/account/home [LOGNAME] => <USER> [OLDPWD] => /.../path/to/account/home [_] => /usr/bin/php [PHP_SELF] => test.php [SCRIPT_NAME] => test.php [SCRIPT_FILENAME] => test.php [PATH_TRANSLATED] => test.php [DOCUMENT_ROOT] => [REQUEST_TIME] => 1381113241 [argv] => Array ( [0] => test.php ) [argc] => 1 )Again, no SERVER_NAME.
Forum: Alpha/Beta/RC
In reply to: PHP Warning on Cron Run in wp_mailBoth dev and prod have the same server and site config (it’s a cPanel server – I have root access – and they’re running under the same *nix account, and I made a direct copy of the prod database, then fixed the site options to point to the right place, when I set up the dev site).
The account has email access – sending the email isn’t the problem (it comes through just fine, aside from the ‘From’ header being “WordPress <wordpress@>”). I tested adding a new user, and received the email just fine (with the ‘From’ header set to “WordPress <wordpress@<DEV_BLOG_DOMAIN>>”).
The $_SERVER superglobal contains the following when run from a cron job:
Array ( [SHELL] => /bin/sh [MAILTO] => <EMAIL> [USER] => <USERNAME> [PATH] => /usr/bin:/bin [PWD] => /.../path/to/account/home [SHLVL] => 1 [HOME] => /.../path/to/account/home [LOGNAME] => <USERNAME> [_] => /usr/bin/php [PHP_SELF] => [REQUEST_TIME_FLOAT] => 1380934742 [REQUEST_TIME] => 1380934741 [argv] => Array ( [0] => /.../path/to/account/home/test.php ) [argc] => 1 )