PHP : Find Path to Base Directory

This script output the path to your base directory (aka “Document Root”), this code also useful to debug PATH in PHP errors

<?php print ($_SERVER['DOCUMENT_ROOT']); ?>

This script output  the path to your base directory with current working dir

<?php echo getcwd(); ?>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: