Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems including php script from another domain 1

Status
Not open for further replies.

lasya

Programmer
Joined
Mar 16, 2004
Messages
4
Location
AU
In domain a i have a php file that defines a class.

when including it in a page in domain b,i get error that the class is not deifined.

Any way i can do it?

Thanks!

 
How are you invoking include()?

Are the two domains on the same physical server?

Is PHP configured to run in safe mode?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
1) I have tried both include() and require_once().

2) Both domain are on the same physical server.

3)php safe mode = off.

Thanks for the quick response!

(BTW - what i am trying to achive:
I have sveral differnet daomin using the same classes and databse, so I am trying to include the relevant php files from one domain in all the other domains).
 
I would not invoke include() using a URL when the file to be included resides on the same filesystem as the script performing the include. For one thing, it's slower, as PHP has to perform DNS lookup and and HTTP fetch on the file.

Use include with filesystem paths and filenames.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks a million!
 
An addendum

Something I did not explicitly say earlier. include() and require() are not limited to the document root of the site in which they are invoked. So long as safe_mode is off, you can freely include files from anywhere on your server's filesystem.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top