Nalaka526 Nalaka526 - 1 year ago 148
PHP Question

Get Root Directory Path of a PHP project

I have this folder structure in my PHP project.
(this is as shown in eclips)


When I try this code


output is


How can I get the path to RootDirectory of the system (
), without hardcoding the Folder Name?

Answer Source

For PHP >= 5.3.0 try

PHP magic constants.


And make your path relatively.

For PHP < 5.3.0 try

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download