I receive hundreds of emails every day error from my WP theme. I do not know why, and even the developer cannot give me some advice, everything seems okay, but obviously it is not. This is the error I get on my postfix mail service:
Return-Path: <[email protected]>
X-Original-To: ubuntu
Delivered-To: [email protected]
Received: by mysite.org (Postfix, from userid 1000)
id C4E78E9B7; Fri, 26 Dec 2014 11:30:01 +0000 (UTC)
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <ubuntu@ip-172-31-12-250> php -q /var/www/html/wp-content/themes/mytheme/cron.php
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/ubuntu>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=ubuntu>
Message-Id: <[email protected]>
Date: Fri, 26 Dec 2014 11:30:01 +0000 (UTC)
X-IMAPbase: 1419593539 75
Status: O
X-UID: 74
PHP Warning: require(../../../wp-load.php): failed to open stream: No such file or directory in /var/www/html/wp-content/themes/mytheme/cron.php on line 2
PHP Fatal error: require(): Failed opening required '../../../wp-load.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/wp-content/themes/mytheme/cron.php on line 2
?
the files are in the correct position, this is the file cron.php:
<?php
require '../../../wp-load.php';
echo file_get_contents(get_template_directory_uri().'/scheduler.php');
?>
this is the scheduler.php file:
<?php
//PLEASE do NOT move me around. I get cranky when I get moved around
//get the wp-load in for the wordpress functions
$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
require_once( $parse_uri[0] . 'wp-load.php' );
//now try calling template function
CheckFunction();
?>
I'm in a WP multisite environment, the wp-load.php is located in "html" folder, it's in the correct location, so why this happen?
It must not be finding the file. Try changing cron.php to a more usuable require:
<?php
// Require WP
require $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php';
// Run code
EDIT:
You can also try a less portable solution that'll work for this server specifically:
<?php
// Require WP
require '/var/www/html/wp-load.php';
If this still doesn't work, it might be a permission issue. Make sure the file permission is 644.
Cheers!
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments