dpacmittal Posted December 15, 2009 Share Posted December 15, 2009 I am making my own script and I want to know a way to make a central config file. My directory structure was like this: /var/www/newscript/ includes.php index.php login.php logout.php register.php /var/www/newscript/ includes/ db.php formvalidation.php common.php etc. Now, includes.php is as such: include('includes/db.php'); include('includes/common.php'); include('includes/security.php'); include('includes/formvalidation.php'); include('includes/forms.php'); include('includes/Email.php'); I just included includes.php to include all those files at once. It was working great until I moved into another directory. I made a new directory named 'mypanel' inside 'newscript'. Now whenever I used that include file, the directory structure would mess everything up. I made a central config.php for all the configuration of site. I gave the full path inside it : $config['path'] = '/var/www/newscript/'; But the problem is that I can't even include config.php from different directories. I don't want to hard code config details into includes.php nor do I want to use database to get full path. Is there any way to get the full path of the /var/www/newscript/index.php using 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.