say i have a file /var/www/foo/test.php
how do i find out it’s path from within it. i’m trying to create an ‘Add To Include Path’ action, and for that i need absolute paths.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
$_SERVER['DOCUMENT_ROOT']to find the path to the current script. If you need the name of the .php file included, add on$_SERVER['SCRIPT_NAME'], like this: