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 12:13:47 EDT 2004


Is there a way to get an equivalent of $PHP_SELF for a PHP script that 
is not residing in the document root?  Apparently if you have PHP 4.3.2 
and Apache 2.0 in Red Hat Linux 7.3, at the very least, $PHP_SELF is 
only populated with content indicating the location of the PHP script 
calling $PHP_SELF if that PHP script resides in Apache's document root 
or below.

But I have some PHP scripts that will be ultimately referenced via cron 
that have to reside outside of the document root.  When I do

[PHP]phpinfo();[/PHP]

I get "no value" for the variable $PHP_SELF.  This tells me apparently 
that it can only identify itself from within the document root. 

So this leaves me with a problem.  How can I find $PHP_SELF, or 
something like $PHP_SELF, in a PHP script that's outside of the document 
root?  I am looking for values within the path that I will need to 
dynamically populate portions of that same PHP script, otherwise, the 
user, upon inheriting these cron files, have to MANUALLY change values 
inside the PHP script every time!

Thanx
Phil

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

	




More information about the talk mailing list