Reputation: 983
Is this the right way to go about referencing a file in a parent directory relative to a php source file?:
require_once('../referenced_file.php');
Upvotes: 0
Views: 3624
Reputation: 55445
To include a file relative to the current source file you should use the full path:
require_once dirname(__FILE__) . '/../referenced_file.php';
As the current working directory is set to the directory of the script that was initially executed.
Upvotes: 8