Genesis5150
asked on
How to use include_once in php with subdomains
Hello folks I have a file in http://mydomain.com/user/classes/check.class.php and would like it to be used in https://subdomain.mydomain.com using include_once How can I achieve this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I don't know about the soon-to-be-extinct list. My use of PHP goes back to 1999, so I encountered PHP on Windows 98, 2000, XP, ME, etc. I have encountered the '/' problem in the past, when building a church web site circa 2000, and that was when I started using the constant. Never looked back.
I can't remember the exact timeline. I changed to DIRECTORY_SEPARATOR long ago because the '/' did not work as desired on Windows hosting. I can't really say when Microsoft made a change because DIRECTORY_SEPARATOR has worked perfectly from day one, and I never had any reason to change back. IIRC, this was in the days of PHP4, but it's been a long time.
This page has some copyright information that seems to point to 2004, since PHP 4.0.6. So I guess Microsoft changed behaviors some time after that.
https://pear.php.net/reference/PHP_Compat-latest/PHP_Compat/_PHP_Compat-1.6.0a3---Compat---Constant---DIRECTORY_SEPARATOR.php.html
This page has some copyright information that seems to point to 2004, since PHP 4.0.6. So I guess Microsoft changed behaviors some time after that.
https://pear.php.net/reference/PHP_Compat-latest/PHP_Compat/_PHP_Compat-1.6.0a3---Compat---Constant---DIRECTORY_SEPARATOR.php.html
http://php.net/manual/en/function.getcwd.php
And if you want to write your code in a way that allows for cross-platform functionality, consider using the context-aware predefined constant: DIRECTORY_SEPARATOR