Avatar of Genesis5150
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?
PHPSSL / HTTPS

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Julian Hansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ray Paseur

Sidebar note:  You may also want to know about this function:
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
Ray Paseur

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.
Ray Paseur

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
Your help has saved me hundreds of hours of internet surfing.
fblack61