0
votes

While i try to deploy the code devloped on wamp server on the dev machine on linux , i get this error: Warning: require_once(/PHP file) [function.require-once]: failed to open stream: No such file or directory in /var/www/proj/index.php on line 38

Fatal error: require_once() [function.require]: Failed opening required '/PHP file' (include_path='.:/var/www/proj:/var/www/proj/framework:') in /var/www/proj/index.php on line 38

Now the PHP file i called is in the path "/var/www/proj/framework"

5

5 Answers

1
votes

You have just supplied wrong filename.
Use proper path to this PHP file

1
votes
require_once("/PHP file")

is using an absolute path and looking for PHP file in the server's filesystem root directory

require_once("./PHP file")

or

require_once("PHP file")

is a relative path that would search for PHP file using the include path

0
votes

Also, to necromance this thread even further, don't forget Windows doesn't care about case-sensitivity, and Unix/Linux does!

0
votes

This work for me, using the magic const of PHP

require once __DIR__ . "/directory/name_file.php";
-1
votes


I have also faced the same problem earlier.
I found on my program that, all path was included using "\" on Windows system and linux supports "/" path separator.
Please check once that all you include path is having "/" path separator.