I’m working with PHP and when I include a file using $_SERVER[‘DOCUMENT_ROOT’] 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.
/home/jtiger/public_html/test1.php
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[‘DOCUMENT_ROOT’] . ‘/test1.php’;
Here is the code that works
include ‘/home/jtiger/public_html/cms/includes/db.inc.php’;
Best I can figure, the Doc_root is calling a different file path than the absolute path
/usr/local/apache/htdocs/test1.php Error
/home/jtiger/public_html/test1.php Works