Php 禁用wp cron,并在多站点环境中运行linux cron
我有一个具有域映射的多站点环境 我尝试使用这两个示例使Linux cron工作,而不是Php 禁用wp cron,并在多站点环境中运行linux cron,php,linux,wordpress,cron,Php,Linux,Wordpress,Cron,我有一个具有域映射的多站点环境 我尝试使用这两个示例使Linux cron工作,而不是wp cron: 然后,我在cPanel中设置了cron,看起来一切都很好,但我开始收到包含cron作业错误的电子邮件: PHP Warning: include_once(/my-cont/sunrise.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream:
wp cron
:
然后,我在cPanel中设置了cron,看起来一切都很好,但我开始收到包含cron作业错误的电子邮件:
PHP Warning: include_once(/my-cont/sunrise.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /home/user/public_html/wp-includes/ms-settings.php on line 18
PHP Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening '/my-cont/sunrise.php' for inclusion (include_path='.:/usr/local/php53/pear') in /home/user/public_html/wp-includes/ms-settings.php on line 18
PHP Notice: Undefined index: HTTP_HOST in /home/user/public_html/wp-includes/ms-settings.php on line 30
有什么想法吗?我也在WordPress多站点环境中运行linux cron作业,并且遇到了与HTTP\U主机相同的错误 我的cron脚本加载wp-load.php以访问WordPress核心函数。当在单个站点上时,它们工作正常,切换到多站点时,我收到了错误 在对WP核心进行全面调试之前,我先尝试了最简单和最明显的方法 在我添加的每个cron脚本中
define('DOING_CRON', true);
if (!isset($_SERVER['HTTP_HOST'])) {
$_SERVER['HTTP_HOST'] = 'domain.com'; // replace with primary host
}
// then load wordpress
require 'wp-load.php';
此操作已足够,并且我的linux cron脚本将在没有进一步事件的情况下恢复sunrise文件是在您的内容目录中,还是在默认的wp内容目录中?您可能只需要将其移动到
my cont
。
define('DOING_CRON', true);
if (!isset($_SERVER['HTTP_HOST'])) {
$_SERVER['HTTP_HOST'] = 'domain.com'; // replace with primary host
}
// then load wordpress
require 'wp-load.php';