Re: [PHP-DEV] How to get script filename in module RINIT function

2010-08-12 Thread Bostjan Skufca
Yes, that did it! I was wondering what those SG and EGs are :) Anyway, the EG(included_files) would not work, because hash values (file paths) are not stored, only keys. Snippet from Zend/zend.h ... zend_hash_add(&EG(included_files), file_handle->opened_path, strlen(file_handle->opened_path)+1, (v

Re: [PHP-DEV] How to get script filename in module RINIT function

2010-08-11 Thread Richard Quadling
On 9 August 2010 12:32, Bostjan Skufca wrote: > Hi all! > > I am developing a small PHP extension and I ATM can't figure out how to get > to $_SERVER['SCRIPT_FILENAME'] content while in PHP_RINIT or PHP_RSHUTDOWN > function. Can someone please hint me with this one? > > Thanks, > b. > If the scri

Re: [PHP-DEV] How to get script filename in module RINIT function

2010-08-10 Thread Johannes Schlüter
Hi, On Tue, 2010-08-10 at 18:43 +0200, Bostjan Skufca wrote: > > Interesting idea. Didn't think about that. But it isn't > reliable either: > If an auto prepend file is set this will be in the list first. > > So simple thing, so easy to overlook... > But I believe

Re: [PHP-DEV] How to get script filename in module RINIT function

2010-08-10 Thread Bostjan Skufca
2010/8/10 Johannes Schlüter > Hi, > > On Tue, 2010-08-10 at 17:24 +0200, Bostjan Skufca wrote: > > I've been digging a little deeper and have figured out that I probably > > could retrieve what I want (realpath of first executed file) from > > included_files hash (first entry, obviously). Unfortu

Re: [PHP-DEV] How to get script filename in module RINIT function

2010-08-10 Thread Johannes Schlüter
Hi, On Tue, 2010-08-10 at 17:24 +0200, Bostjan Skufca wrote: > I've been digging a little deeper and have figured out that I probably > could retrieve what I want (realpath of first executed file) from > included_files hash (first entry, obviously). Unfortunately, doing it > like this (sampled fro

Re: [PHP-DEV] How to get script filename in module RINIT function

2010-08-10 Thread Bostjan Skufca
I've been digging a little deeper and have figured out that I probably could retrieve what I want (realpath of first executed file) from included_files hash (first entry, obviously). Unfortunately, doing it like this (sampled from get_included_files() implementation): char *hentry; zend_ha

Re: [PHP-DEV] How to get script filename in module RINIT function

2010-08-09 Thread Bostjan Skufca
I don't think I made myself exactly clear. There are 2 use cases I would like to consider: 1. CLI: by using "php /full/path/to/script.php" or "cd /full/path/to && php script.php" 2. Apache DSO: going to http://www.domain.com/script.php which in turn 'executes' script "/full/path/to/script.php" In

Re: [PHP-DEV] How to get script filename in module RINIT function

2010-08-09 Thread Johannes Schlüter
On Mon, 2010-08-09 at 13:32 +0200, Bostjan Skufca wrote: > Hi all! > > I am developing a small PHP extension and I ATM can't figure out how to get > to $_SERVER['SCRIPT_FILENAME'] content while in PHP_RINIT or PHP_RSHUTDOWN > function. Can someone please hint me with this one? The simple answer i