Danny696 Posted June 15, 2009 Share Posted June 15, 2009 I Was wodering what is the stafest way of including globas the most common one is <?php include "globals.php"; but ive seen things like <?php include_once (DIRNAME(__FILE__) . '/globals.php'); and like <?php include_once "globals.php'; and <?php include("globals.php"); ?> and <?php include 'globals.php'; and <?php include "$_SERVER['PHP_SELF'];" and <?php include($_SERVER['DOCUMENT_ROOT'] . '/globals.php'); mccodes normally uses the first one but i was wondering whats the best and safest way of doing it? Quote Link to comment Share on other sites More sharing options...
Lithium Posted June 15, 2009 Share Posted June 15, 2009 Re: incuding a file http://pt2.php.net/manual/en/function.include.php Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted June 16, 2009 Share Posted June 16, 2009 Re: incuding a file Well, consider this a question you should be asking your host. Do they have open_basedir set? And is it pointed to the user's public_html, some host's don't allow file include's outside of public_html. So if open_basedir is set best is to: include_once('globals.php'); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.