Forum Moderators: coopster
require ('http://'.$_SERVER['SERVER_NAME'].'/allincludes.php');
I am using require to include a file called allincludes.php, In which i have made some variables. I would like the variables to be available on any page that i require allincludes.php into.
//contents of allincludes.php
$images = "/images/big";
My problem is that when i echo one of my variables defined in the allincludes.php i get nothing as if the variable has not been defined.
If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Appendix M for a list of protocols) instead of a local pathname.
Just thought I'd let you know, whoisgregg. However the problem may be that URL fopen wrappers [us2.php.net] aren't enabled, in which case you will have to use the method described by whoisgregg or enable them.
In bleak26's case, it sounds like there is a file with a bunch of variables defined, but nothing echo'ed. So, including that file through a URL is the same as including an empty file where using the local absolute path will keep those variables defined for use in the script doing the including.
ahh, yes. silly me ;)