J'obtiens l'erreur suivante après le passage au multisite lors de l'exécution de mon 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
Mon fichier 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");
Et oui : ce fichier PHP cronjob n'est qu'un exemple. J'ai besoin d'accéder à toutes les fonctions de WordPress. Si je supprime l'appel à wp-load.php, cela fonctionne. Lorsque mon site n'était pas multisite, cela fonctionnait. Maintenant, cela ne fonctionne pas pour cette erreur.