I use WAMP and have a development site in the www directory. I want to use dirname(__FILE__) to determine the path to the server root.
I am currently using a configuration file that contains:
define('PATH', dirname(__FILE__));
I include the configuration file in my header.php file as follows:
<?php require_once("config.php") ?>
Then, on my auxiliary pages, I use the PATH constant to determine the path by including header.php .
<?php require_once("../inc/header.php"); ?>
However, my links come out as follows:
<link rel="stylesheet" href="C:\wamp\www/css/style.css" />
What do I need to do to fix this? And since I include my constant in the header.php file, I donβt have access to the constant in the initial require_once("../inc/header.php"); . What other method can I use to find the root for header.php ?
source share