WordPress 多站点中断包括/要求 wp-load.php
WordPress multisite breaks including / require of wp-load.php
我的 cronjob 运行 移动到多站点后出现以下错误:
Notice: Undefined index: HTTP_HOST in /var/www/html/myapp/wp-includes/ms-settings.php on line 38
Call Stack:
0.0009 392912 1. {main}() /var/www/html/myapp/wp-content/themes/fundingpress-child/test.php:0
0.0010 395888 2. require('/var/www/html/myapp/wp-content/themes/fundingpress-child/bootstrap.php') /var/www/html/myapp/wp-content/themes/fundingpress-child/test.php:6
0.0065 687056 3. require_once('/var/www/html/myapp/wp-load.php') /var/www/html/myapp/wp-content/themes/fundingpress-child/bootstrap.php:7
0.0066 699048 4. require_once('/var/www/html/myapp/wp-config.php') /var/www/html/myapp/wp-load.php:37
0.0074 800592 5. require_once('/var/www/html/myapp/wp-settings.php') /var/www/html/myapp/wp-config.php:89
0.0329 3665088 6. require('/var/www/html/myapp/wp-includes/ms-settings.php') /var/www/html/myapp/wp-settings.php:103
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/myapp/wp-includes/ms-settings.php:38) in /var/www/html/myapp/wp-includes/ms-settings.php on line 187
Call Stack:
0.0009 392912 1. {main}() /var/www/html/myapp/wp-content/themes/fundingpress-child/test.php:0
0.0010 395888 2. require('/var/www/html/myapp/wp-content/themes/fundingpress-child/bootstrap.php') /var/www/html/myapp/wp-content/themes/fundingpress-child/test.php:6
0.0065 687056 3. require_once('/var/www/html/myapp/wp-load.php') /var/www/html/myapp/wp-content/themes/fundingpress-child/bootstrap.php:7
0.0066 699048 4. require_once('/var/www/html/myapp/wp-config.php') /var/www/html/myapp/wp-load.php:37
0.0074 800592 5. require_once('/var/www/html/myapp/wp-settings.php') /var/www/html/myapp/wp-config.php:89
0.0329 3665088 6. require('/var/www/html/myapp/wp-includes/ms-settings.php') /var/www/html/myapp/wp-settings.php:103
0.0346 3804784 7. header() /var/www/html/myapp/wp-includes/ms-settings.php:187
我的 cronjob php 文件:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
require_once( __DIR__ .'/../../../wp-load.php' );
?>
bippo
<?php
$myfile = fopen(__DIR__ . "/xxxxxxxxxxxxxxxxxxxxnewfile.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
$txt = "Jane Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
die("bb");
是的:这个 cronjob PHP 文件只是一个例子。我需要访问所有 WordPress 功能。如果我删除 wp-load.php 调用,这有效。当我的站点不是多站点时,这是有效的。现在,它对上述错误不起作用。
global $_SERVER;
$_SERVER['HTTP_HOST'] = 'www.mydomain.com';
$_SERVER['REQUEST_URI'] = '/';
require_once( __DIR__ .'/../../../wp-load.php' );
似乎 解决了我的问题,其中 mydomain 应该是您的实际域(localhost.localdomain
可能在本地使用或 localhost
,我使用了本地虚拟域主持人)
我的 cronjob 运行 移动到多站点后出现以下错误:
Notice: Undefined index: HTTP_HOST in /var/www/html/myapp/wp-includes/ms-settings.php on line 38
Call Stack:
0.0009 392912 1. {main}() /var/www/html/myapp/wp-content/themes/fundingpress-child/test.php:0
0.0010 395888 2. require('/var/www/html/myapp/wp-content/themes/fundingpress-child/bootstrap.php') /var/www/html/myapp/wp-content/themes/fundingpress-child/test.php:6
0.0065 687056 3. require_once('/var/www/html/myapp/wp-load.php') /var/www/html/myapp/wp-content/themes/fundingpress-child/bootstrap.php:7
0.0066 699048 4. require_once('/var/www/html/myapp/wp-config.php') /var/www/html/myapp/wp-load.php:37
0.0074 800592 5. require_once('/var/www/html/myapp/wp-settings.php') /var/www/html/myapp/wp-config.php:89
0.0329 3665088 6. require('/var/www/html/myapp/wp-includes/ms-settings.php') /var/www/html/myapp/wp-settings.php:103
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/myapp/wp-includes/ms-settings.php:38) in /var/www/html/myapp/wp-includes/ms-settings.php on line 187
Call Stack:
0.0009 392912 1. {main}() /var/www/html/myapp/wp-content/themes/fundingpress-child/test.php:0
0.0010 395888 2. require('/var/www/html/myapp/wp-content/themes/fundingpress-child/bootstrap.php') /var/www/html/myapp/wp-content/themes/fundingpress-child/test.php:6
0.0065 687056 3. require_once('/var/www/html/myapp/wp-load.php') /var/www/html/myapp/wp-content/themes/fundingpress-child/bootstrap.php:7
0.0066 699048 4. require_once('/var/www/html/myapp/wp-config.php') /var/www/html/myapp/wp-load.php:37
0.0074 800592 5. require_once('/var/www/html/myapp/wp-settings.php') /var/www/html/myapp/wp-config.php:89
0.0329 3665088 6. require('/var/www/html/myapp/wp-includes/ms-settings.php') /var/www/html/myapp/wp-settings.php:103
0.0346 3804784 7. header() /var/www/html/myapp/wp-includes/ms-settings.php:187
我的 cronjob php 文件:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
require_once( __DIR__ .'/../../../wp-load.php' );
?>
bippo
<?php
$myfile = fopen(__DIR__ . "/xxxxxxxxxxxxxxxxxxxxnewfile.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
$txt = "Jane Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
die("bb");
是的:这个 cronjob PHP 文件只是一个例子。我需要访问所有 WordPress 功能。如果我删除 wp-load.php 调用,这有效。当我的站点不是多站点时,这是有效的。现在,它对上述错误不起作用。
global $_SERVER;
$_SERVER['HTTP_HOST'] = 'www.mydomain.com';
$_SERVER['REQUEST_URI'] = '/';
require_once( __DIR__ .'/../../../wp-load.php' );
似乎 解决了我的问题,其中 mydomain 应该是您的实际域(localhost.localdomain
可能在本地使用或 localhost
,我使用了本地虚拟域主持人)