Page 1 of 1

can use inclue outside main directory

PostPosted: 05. January 2019 01:34
by nisroc00
I just installed Xampp portable on a flash disk and I'm having issues using include to call a file from another folder. everything runs just fine if the if everything is in the root directory. Any help with this would be very appreciated.

The errors
Code: Select all
Warning: include(/test/test_file.php): failed to open stream: No such file or directory in E:\xampp\htdocs\test.php on line 3

Warning: include(): Failed opening '/test/test_file.php' for inclusion (include_path='.;E:\xampp\php\includes') in E:\xampp\htdocs\test.php on line 3


main php code
Code: Select all
<?php include "/test/test_file.php"; ?>


Included file code in a folder test
Code: Select all
<?php echo "passed"; ?>

Re: can use inclue outside main directory

PostPosted: 05. January 2019 07:55
by Altrea
Include is a file system operation. A path beginning with a slash is not relative to a Document_Root.