I am trying to include a php file from the parent directory and I getting error:
admin@webby:~$ /usr/bin/php /var/phpscripts/email_parser/tests/_email-test.php PHP Fatal error: require_once(): Failed opening required '../PlancakeEmailParser.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/phpscripts/email_parser/tests/_email-test.php on line 6
Fatal error: require_once(): Failed opening required '../PlancakeEmailParser.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/phpscripts/email_parser/tests/_email-test.php on line 6
PHP file
#!/usr/bin/php
<?php
error_reporting(E_ALL ^ E_NOTICE ^E_WARNING);
ini_set("display_errors" , 1);
require_once("../PlancakeEmailParser.php");
// etc
?>
Folder Structure
admin@webby:/var/phpscripts/email_parser$ find .
.
./composer.json
./README.txt
./LICENSE.txt
./PlancakeEmailParser.php
./tests
./tests/_email-test.php
For testing it works fine when I move PlancakeEmailParser.php
into the tests
directory and remove the "../" from the require
require_once(__DIR__."/../PlancakeEmailParser.php");
– Get Off My Lawngetcwd()
and the value of the setting:var_dump(getcwd(), get_include_path());
to explain this better. – hakre