NYCPHP Meetup

NYPHP.org

[nycphp-talk] FUNDAMENTALS #1: Site Structure

Analysis & Solutions danielc at analysisandsolutions.com
Fri Sep 5 00:18:01 EDT 2003


Hey Folks:

Quick response, since I'm busy...  Most of my operations are on shared
hosts and I do all of my development on my office machine.  Here's how I
configure.

There are two include directories.  One on the web server for unimportant
stuff.  One in the home directory.  PHP scripts that need access to the
secure files in the home directory are run in CGI mode.

Here's a quick listing of some sample files and their contents...

vvvvvvvvvvvvvvvvvvvv

WEBSERVER
/htdocs/username/.htaccess
    DirectoryIndex index.php

    AddType application/x-httpd-php .inc

    <Files *htaccess>
    Deny from all
    </Files>

    <Files *inc>
    Deny from all
    </Files>

/htdocs/username/index.php
    include('./directory.inc');
    include("$IncludeDir/inc-user.inc");

/htdocs/username/directory.inc
    $IncludeDir = './include';

/htdocs/username/include/index.php
    <p>Go Away!</p>

/htdocs/username/include/<unimportant include files go here, such as...>
/htdocs/username/include/inc-user.inc
    #  This makes the deployment portable!
    switch ($_SERVER['SERVER_NAME']) {
        case 'analysisandsolutions.localhost':
            $SafeIncludeDir = 'x:/blah/foo';
            break;

        default:
            $SafeIncludeDir = '/users/username/include';
    }

    include("$SafeIncludeDir/the.secure.settings.inc");

    include("$IncludeDir/some.open.source.script.inc");


USERHOST
/users/username/include/<secure files go here, such as...>
/users/username/include/the.secure.settings.inc
    $UserName = 'canyou';
    $Password = 'guess!';

^^^^^^^^^^^^^^^^

Enjoy,

--Dan

-- 
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409



More information about the talk mailing list