Forum Moderators: coopster
<? require("/global.php");?> gives me errors...
Anyone got the correct syntax for this? I've never really used global includes on sites with sub-dirs. thx.
sauce
when you use
require('/somefile.php')
The PHP is looking for the file in the server root folder.
The best way would be to use the full server path to the file
require('/home/user/file.php')
Check the full server path to your hosting account with your web hosting provider, then use it in your require() calls.
Another option could be to use:
require($_SERVER['DOCUMENT_ROOT']."/somefile.php");
however, the latter may not work with some server setups as the DOCUMENT_ROOT variable may be different from the real server path to your web root.