Getting php includes working in mamp and online

Right now i am working on my site with mamp on localhost. I have includes inside of includes in different directories (by necessity) so things break using relative paths.

so i’d likely want to be using absolute paths in many cases, which i don’t totally understand. I know I have to potentially edit php.ini or use htaccess and $_SERVER[‘DOCUMENT_ROOT’ and a variable… but reading all these different solutions i’m finding online is just making me more confused.

I want to make testing and deploying not require too much work, and I’ve seen people recommend a variable where you can set the root path, but not really sure how to do that. And i also want to make sure it’s something that will be easy to acheive on dreamhost, or any other server.