1

I am running a php command (edited) from the command line that runs a php file on the web server.

In that file I need to include a file that is one level up from its location.

I have tried

include(../the_file_in the parent.php) 

and every other suggestion I could find here for the last two days.

I keep getting the same error in the CLI:

PHP Warning:  require_once($_SERVER[DOCUMENT_ROOT]/html/wp-load.php): failed to open stream: No su
ch file or directory in /var/www/html/wp-admin/email_processor.php on line 16
PHP Fatal error:  require_once(): Failed opening required '$_SERVER[DOCUMENT_ROOT]/html/wp-load.ph
p' (include_path='.:') in /var/www/html/wp-admin/email_processor.php on line 16

As with all thing computing, I have a sneaking suspicion this is ridiculously simple...that’s why it is taking so long to get it sorted.

Any assistance would be greatly appreciated.

1 Answer 1

2

This might be useful:

<?php
  include $_SERVER['DOCUMENT_ROOT']."/parentfilepath/filename.php";
?>

or

include __DIR__ . '/../parentfile.php';
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! DIR did the trick. I found that shortly after posting the question in this thread stackoverflow.com/questions/8826567/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.