NYCPHP Meetup

NYPHP.org

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

Joel De Gan joel at tagword.com
Tue May 18 16:54:42 EDT 2004


On Tue, 2004-05-18 at 15:23, Phillip Powell wrote:
> 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

like so.. why are you messing around with csv files?

file config.php
<?
	define("APPPATH", "/var/www/html/project");
?>

file app.php
<?
	include 'config.php';
	echo APPPATH ."\n";
?>

bash-2.05b$ php app.php
/var/www/html/project


-- 
joeldg - developer, Intercosmos media group.
http://lucifer.intercosmos.net




More information about the talk mailing list