Jump to content
Sign in to follow this  
fatkatie

including that first file in php

Recommended Posts

I run a php script in three main environments.   Unique environment parameters/defs are defined in a file defs.php.  This file must run first in any script.

 

I'm trying to figure out how to find it.

 

A php script can light up anywhere, so I have three ideas about how to do this.  Input please.

 

1.  Distribute the def.php as linked files in all the directories which contain php scripts that use it.  In windows I think its a copy option only.  This is small file so I'm not worried about casting it about.

 

2.  Do an logic thing like:

if ((include '/xampp/htdocs/news/defs.php') == false) {
   include '/home/networkHALTSTANK/public_html/news/defs.php';
}

3. Use the Apache server somehow to do this ... which I'll investigate if someone will please point the way.  One of the Apache servers resides on a godaddy unix share so I don't have access to all the switches.

 

Thanks.

Share this post


Link to post
Share on other sites

Use

$_SERVER['DOCUMENT_ROOT'] ... defs.php

and then add whatever path you are using to get to the defs.php file.

 

Only have one version of the file, otherwise it will be a nightmare to keep up to date and pointless having it in the first place.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.