NYCPHP Meetup

NYPHP.org

[nycphp-talk] Include file questions

leam leam at reuel.net
Sat Feb 14 12:54:16 EST 2004


Okay, I have two different situations to work through. The first is the 
home test box that I can mess up, er, control however I like. The second 
is a shared ISP box where I don't have a lot of control but the web 
pages are in a sub-directory of my home directory. Thus I can have, on 
both, a "php" directory for include files that is outside the docroot.

On one is it /var/www/php and on the other /home/$USERNAME/php. My 
solution so far, and I'd certainly listen to improvments, is:

   $DOCDIR = explode("/", "$_SERVER[DOCUMENT_ROOT]");
   array_pop($DOCDIR);
   array_push($DOCDIR, "php");
   $PHPDIR = implode("/" , $DOCDIR );

I can then:

   include("$PHPDIR/common_html.inc");

And it works on either machine. Are there ways to improve this?

ciao!

leam


Jeff Siegel wrote:
> For question 1, See: http://phundamentals.nyphp.org/
> Specifically, "Site Structure: Where to Locate Includes?"
> 
> Jeff Siegel
> ===============
> 
> leam wrote:
> 
>> Noob here again, wondering about include files.
>>
>> 1. Where is a good place to put them so that they are outside the
>> docroot yet centrally located for the apache/mysql/php instance?
>>
>> 2. Do you tend to have uniquely configured include files or just a few
>> for overall use? For example, if you had two different instances of
>> MySQL running, would you have seperate include files for the pages that
>> referenced each or would you use one with differnet variable names?
>>
>> 3. What are some things you usually use for include files? What are some
>> things you*could* put in that you don't?
>>
>> Thanks!
>>
>> leam






More information about the talk mailing list