RE: [PHP] Site Structure

From: Date: Mon, 23 Apr 2001 19:50:27 +0000
Subject: RE: [PHP] Site Structure
Groups: php.general 
Request: Send a blank email to php-general+get-49926@lists.php.net to get a copy of this message
You could always: include( "$DOCUMENT_ROOT/../includes/whatever.inc" ); or better yet, define include_path and then just: include( "whatever.inc" ); This give you the best of both worlds. You never need to worry about different dir. structures on dev, staging, and production servers, AND you can keep your includes out of a web server accessible directory. Martin Gottlieb -----Original Message----- From: Toby Miller [mailto:tmiller@creativegeneration.com] Sent: Monday, April 23, 2001 3:44 PM To: indrek siitan Cc: PHP General Mailing List Subject: Re: [PHP] Site Structure While it is true that you don't have to put your files in the web directory at all and it is a more secure option there is still one very large inconvenience that prevents me from going with that option. You lose the usefulness of just including "$DOCUMENT_ROOT/yourfolder/yourfilename". This is the main reason that I do put my files in the root web directory. So how do you tell all of your files where your included content is? Do you hard code the path in every page? If so, do you also have development, stage, and live environments that mimic the exact same directory structures? If not, do you always change the include strings by hand every time you move from one environment to another? Do you run into these problems? What kind of solutions/workarounds have you implemented? I have always used this style of including documents because it enables me to do my mockup ideas on my Windows machine with PWS. Then I can move onto my Linux test box and try the site in my home account. Then I can push the exact same code to the dev server which uses www as the root web directory. Then I can push the exact same code to the staging server for clients to see which has wwwroot as the root web directory and the live environment mimics the stage environment so that move makes little to no difference. Now if someone else was working on the same project and checked the files out of CVS they would have to tweak their copy to work in their special environment instead of just running and developing the files. This just seems like a whole lot of extra work to me. Correct me if I'm wrong, but the only way anyone can see the source code of a php file if the extension is associated with the PHP interpreter is if you provide a phps file that they can see or if someone uninstalls the PHP interpreter (which bypasses the situation because the first condition is no longer being met). I'm really curious to see how other developers handle these kind of development situations. ----- Original Message ----- From: "indrek siitan" <tfr@mysql.com> To: "Toby Miller" <tmiller@creativegeneration.com>; "Jordan Elver" <jjelver@worldsites.net> Cc: "PHP General Mailing List" <php-general@lists.php.net> Sent: Monday, April 23, 2001 1:22 PM Subject: RE: [PHP] Site Structure > Hi, > > > Also, it's not a good idea to use the .inc extension unless you've > > associated it with PHP. The reason is if I type the URL directly to > > /includes/header.inc I will get the source code for that file in text > > format. > > you don't have to keep your .inc files in the web server document > root folder at all... > > > Rgds, > Tfr > > --==< tfr@mysql.com >==< MySQL development team >==< Tallinn / Estonia >==-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#49926) next »