From:             
Operating system: 
PHP version:      5.3SVN-2011-03-31 (SVN)
Package:          *General Issues
Bug Type:         Feature/Change Request
Bug description:sapi_module.executable_location is not a real path in all 
circumstances.

Description:
------------
Hi.



I'm looking and learning.



In sapi_module, there is an entry called executable_location.



The name (executable_location) doesn't match the content which is the name
that was entered by the user (for the CLI sapi for example).



At the command line, I can type ...



php



and my PATH is examined by the OS to find the first php file whose
extension is in my list of PATHEXTs will be used. This all happens along
the same lines that I 

documented at 

http://docs.php.net/manual/en/install.windows.commandline.php for running
php scripts from the command line without the need to type the php.exe or
the .php part.



The program is ran and argv[0] will be 'php'.



Not C:\PHP5\php.exe



I did a search on executable_location on PHP5.3 and all of PECL (the only
PECL use is in http://pecl.php.net/package/proctitle ("This extension
allows changing the 

current process' name on Linux and *BSD systems. This is useful 

when using pcntl_fork() to identify running processes in process list").



There are 2 main uses.



1 - Population.



The SAPIs CLI, CGI, embed, fpm, litespeed and milter all populate the
entry. The others SAPIs don't.



If it is populated by ...



xxx_sapi_module.executable_location = argv[0];





This reflects the issue I see in that the executable_location is not really
a location, just the name passed to the program from the command line.





2 - Used to determine where a local php.ini file is.



In main/php.ini, sapi_module.executable_location is checked to see if it is
set.



Then, for windows, the win32 call to GetModuleFileName() is called and that
returns the real location of the exe. For non-win32, a loop through PATH is
performed, 

looking for the executable_location filename in each location.



In both cases, the variable binary_location is populate with the physical
location of the executable.







Could this be assigned to sapi_module.executable_location?



I think the definition may need to change from a *char to a char array or
another char array created during SAPI initialization and freed during the
SAPI teardown.





The searching in the local directory was a bug fix from
http://bugs.php.net/bug.php?id=33882, but having the executable_location
updated would be useful for reporting 

later on if there is a problem.


-- 
Edit bug report at http://bugs.php.net/bug.php?id=54432&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54432&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54432&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54432&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54432&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54432&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54432&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54432&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54432&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54432&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54432&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54432&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54432&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54432&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54432&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54432&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54432&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54432&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54432&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54432&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54432&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54432&r=mysqlcfg

Reply via email to