简体   繁体   中英

Php script not finding include file

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.

This might be useful:

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

or

include __DIR__ . '/../parentfile.php';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM