failed to open stream: No such file or directory (but files are in the correct location)

user4096916

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?

versalle88

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

PHP - Failed to open stream : No such file or directory

From Java

failed to open stream: No such file or directory (Laravel)

From Dev

file_get_contents() failed to open stream: No such file or directory

From Dev

Warning: include(PHPExcel.php): failed to open stream: No such file or directory

From Dev

SplFileObject error failed to open stream: No such file or directory

From Dev

autoload.php issue: failed to open stream: no such file or directory

From Dev

Failed to open stream: No such file of directory in... PHP fopen

From Dev

php artisan migrate:reset failed to open stream: No such file or directory

From Dev

File exists but PHP throwing "failed to open stream: no such file or directory"

From Dev

app/bootstrap.php.cache : failed to open stream: No such file or directory

From Dev

Laravel classloader.php error failed to open stream: No such file or directory

From Dev

file_get_contents(): failed to open stream: No such file or directory

From Dev

move_uploaded_file(...): failed to open stream: No such file or directory

From Dev

Zend include_once(myphpfile): failed to open stream: No such file or directory

From Dev

PHPUnit error "Failed to open stream: No such file or directory"

From Dev

File upload on s3 : failed to open stream: No such file or directory

From Dev

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

From Dev

PHP - failed to open stream: No such file or directory in

From Dev

yii PDO.php error: failed to open stream: No such file or directory

From Dev

File exists but PHP throwing "failed to open stream: no such file or directory"

From Dev

file exists but fopen "failed to open stream no such file or directory"

From Dev

file_get_contents(): failed to open stream: No such file or directory

From Dev

Warning: include(dbconn.php): failed to open stream: No such file or directory

From Dev

Failed to open stream: No such file or directory in...? PHP Specific

From Dev

Zend include_once(myphpfile): failed to open stream: No such file or directory

From Dev

Failed to open stream: No such file or directory

From Dev

PHP/SQL - failed to open stream: No such file or directory

From Dev

failed to open stream: No such file or directory

From Dev

failed to open stream: No such file or directory issue

Related Related

  1. 1

    PHP - Failed to open stream : No such file or directory

  2. 2

    failed to open stream: No such file or directory (Laravel)

  3. 3

    file_get_contents() failed to open stream: No such file or directory

  4. 4

    Warning: include(PHPExcel.php): failed to open stream: No such file or directory

  5. 5

    SplFileObject error failed to open stream: No such file or directory

  6. 6

    autoload.php issue: failed to open stream: no such file or directory

  7. 7

    Failed to open stream: No such file of directory in... PHP fopen

  8. 8

    php artisan migrate:reset failed to open stream: No such file or directory

  9. 9

    File exists but PHP throwing "failed to open stream: no such file or directory"

  10. 10

    app/bootstrap.php.cache : failed to open stream: No such file or directory

  11. 11

    Laravel classloader.php error failed to open stream: No such file or directory

  12. 12

    file_get_contents(): failed to open stream: No such file or directory

  13. 13

    move_uploaded_file(...): failed to open stream: No such file or directory

  14. 14

    Zend include_once(myphpfile): failed to open stream: No such file or directory

  15. 15

    PHPUnit error "Failed to open stream: No such file or directory"

  16. 16

    File upload on s3 : failed to open stream: No such file or directory

  17. 17

    Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

  18. 18

    PHP - failed to open stream: No such file or directory in

  19. 19

    yii PDO.php error: failed to open stream: No such file or directory

  20. 20

    File exists but PHP throwing "failed to open stream: no such file or directory"

  21. 21

    file exists but fopen "failed to open stream no such file or directory"

  22. 22

    file_get_contents(): failed to open stream: No such file or directory

  23. 23

    Warning: include(dbconn.php): failed to open stream: No such file or directory

  24. 24

    Failed to open stream: No such file or directory in...? PHP Specific

  25. 25

    Zend include_once(myphpfile): failed to open stream: No such file or directory

  26. 26

    Failed to open stream: No such file or directory

  27. 27

    PHP/SQL - failed to open stream: No such file or directory

  28. 28

    failed to open stream: No such file or directory

  29. 29

    failed to open stream: No such file or directory issue

HotTag

Archive