Basically, I have a class Avian that contains logic for some basic things such as:
- Connecting to MySQL
- Checking login status
- Displaying the navigation bar
These files are stored in “projectavian” which is a folder within my host’s root directory and is the folder for all files that will display on mydomain.com.
I’ve gone and set up a few subdomains such as dev.mydomain.com. My host creates folders for subdomains in the root directory alongside the “projectavian” folder. The furthest back that I seem to be able to go from within a HTML/PHP page in “projectavian” or the folder for my subdomain is up to this folder only (ie I can’t actually access the root by going "/subdomain_folder" or adding as many "../"s as I want.
All I need to do is use include or require to get my PHP class from mydomain.com on a page that’s at dev.mydomain.com. Obviously you can’t do include "http://somedomain.com/file.php". Is there maybe a PHP function that can access the server root directory?
You can use magic constants combined with dirname like this:
which lets you access your root directory and from there you can do something like:
check out these references for both dirname and the magic constant
http://php.net/manual/en/function.dirname.php
http://php.net/manual/en/language.constants.predefined.php