I'm working with PHP and when I include a file using $SERVER['DOCUMENTROOT'] on the domain, or a sub domain the include works wonderfully.
But when I use the temp URL I get this error
Warning: include(/usr/local/apache/htdocs/test1.php) [function.include]: failed to open stream: No such file or directory in /home/jtiger/public_html/test.php on line 3
Warning: include() [function.include]: Failed opening '/usr/local/apache/htdocs/test1.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/jtiger/public_html/test.php on line 3
BUT if I was to use this absolute path in the include it works.
As you can figure, that is a major issue if I was to move this site form a domain to a temp url. And I want to use the Temp URL for I can use a shared SSL with it.
Here is my code that causes the error.
include $SERVER['DOCUMENTROOT'] . '/test1.php';
Here is the code that works
Best I can figure, the Doc_root is calling a different file path than the absolute path
You probably want to use $SERVER['HTTPHOST'] or $SERVER['SERVERADDR'].
to see what works for you.
It looks like your temporary location is on your local computer? Are you using something like XAMPP or MAMP? You can set things up locally to work the same as on your server.
This topic is now closed. New replies are no longer allowed.