[TYPO3-dev] update reference using php-cli?

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Fri May 19 09:34:13 CEST 2006


Bernhard Kraft schrieb:
> Tonni Aagesen wrote:
> 
> 
>>- define('PATH_thisScript',$_ENV['_']?$_ENV['_']:$_SERVER['_']);
>>+ define('PATH_thisScript',$_ENV['PWD']?$_ENV['PWD']:$_SERVER['PWD']);
> 
> 
> I already complained about that some times ... in my opinion the only portable way
> is:
> 
>>+ define('PATH_thisScript', __FILE__);

So __FILE__ always returns the full path of the current file (not script):

/dir# php subdir/script.php

/dir# script.sh

script.sh contains "php subdir/script.php"

/dir/subdir# script.php

In this examples it should always be /dir/subdir/script.php.

If it's the case we should really use it. It'll save many problems when 
running on Windows (via .bat and Windows scheduler, eg direct mail scripts).

Masi




More information about the TYPO3-dev mailing list