Local debugging and relative-to-root link mismatch

Files which are intended to reference what would be the root directory of my site aren’t properly located by my computer when debugging locally, I believe because my computer is assuming the root directory is C:/ and not C:/Users/User/Desktop/webdev/my_site/. I’m referring to syntax like this:

<? php include '/includes/header.php' ?>

which results in the code throwing errors because it can’t find the content. Is anyone aware of a work-around for this?

1 Like

How are you starting your test server?

URI requests are served from the current working directory where PHP was started, unless the -t option is used to specify an explicit document root.