Creating absolute path in PHP

I’ve created a PHP file url.php and wrote this codes –

<?php
define("BASE_URL", "/geo15/" );
define("ROOT_PATH", $_SERVER['DOCUMENT_ROOT'] . "geo15/" );
?>

I’ve included the url.php file in several pages but when I browse those files, I get this error message:

Warning: require_once(inc/url.php): failed to open stream: No such
file or directory in C:wampwwwgeo15incheader.php on line 1

But when I paste the path C:wampwwwgeo15incheader.php in my browser’s URL bar, it opens.

N.B. I’m using WAMP server for the development.


Source: wampserver

Leave a Reply