But when I am trying to include upload.php it generates a warning. Warning : require(…app/init.php): failed to open stream: No such file or directory in /home1/…/amazons3/public/upload.php on line 6
This is line 6 →
<?php require '../app/init.php'; ?>
I still feel I am not making any mistake, but still, the error is there.
Woulda thought you of all people benanamen would be arguing that you should still put it there even if it’s not required.
Odd, missing a require should be an E_FATAL, not an E_WARN… (technically it should be E_COMPILE_ERROR which should be raised at E_FATAL level)
Regardless. “..” means “Go up one level”. Start at upload.php, and follow the path you have given. Do you get to init.php? (Hint: No) What does the path need to be to get to the directory you’re trying to reach, given your starting point?
EDIT: okay Marc, you’ve really gotta stop posting at 4 in the morning before you learn to read.
If the file is being included by another file, the relative paths become relative to the file that’s including upload.php.
if you’re directly calling example.com/upload.php, and the file exists where your screenshot shows on the server, then the line as written should work.
Are you sure you’ve uploaded init.php ? Either it doesnt exist, or your webserver only serves files from the /public folder, because going to http://app.trafficopedia.com/amazons3/app/init.php gives me a 404.
Aside: I see why it generated an E_WARN though, it failed to find where indicated, but was still digging through its possible Path folders. It E_FATAL’d once it ran out of possible locations to look in.