NYCPHP Meetup

NYPHP.org

[nycphp-talk] How do you do the equivalent of $PHP_SELF for PHP scripts not in docroot?

Phillip Powell phillip.powell at adnet-sys.com
Tue May 18 15:23:00 EDT 2004


Joel De Gan wrote:

>On Tue, 2004-05-18 at 14:24, Phillip Powell wrote:
>  
>
>>Here's the problem.  Suppose that my company wants to market this 
>>product out to another client, Foo Industries.  That would mean that the 
>>folks that get my application will have to literally MANUALLY change the 
>>lines in index.php from 'acme' to 'foo' or whatever the folder name will 
>>be for that client.  This is, of course, quite a major-league hassle to 
>>ask for.  And frankly, I just can't think of any system I want to use 
>>that would be able to automate the process so that the code in index.php 
>>can remain fairly "static" and not needing to be physically altered from 
>>client to client.
>>
>>If anyone can think of how I might be able to approach this, I'm all ears.
>>    
>>
>
>Well, how most generally do it is via a define, in a config.
>define("APPPATH", "/var/www/html/project");
>
>Then in code that includes this file with this and other settings.
>You call defined vals like so
>
>include APPPATH ."/file.php";
>
>Does that answer the question?
>getcwd() is what I usually use to set this all programmatically.
>
>  
>
Yes and no.  Perhaps my understanding of "config" and "define" are a bit 
overcomplicated in my head for me to come up with a simplified version, 
so I came up with the complex one, as usual.

I created a binary 0644 text CSV file that reads the required globals 
and sets them into $_SESSION variables one time shot only.  Problem is 
that the CSV file is 0644, a huge security HOLE!  It needs to be 0600, 
but then Apache can't read it and the application breaks.  The CSV file 
is created via a command-line PHP scripts "install.php" which creates it 
in /home/me/scripts/cron and then you have to physically move it to the 
docroot, in the same place as index.php

Phil



-- 
---------------------------------------------------------------------------------
Phil Powell
Multimedia Programmer
BPX Technologies, Inc.
#: (703) 709-7218 x107 
Fax: (703) 709-7219

	




More information about the talk mailing list