php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27968 segmentation violation when running cli and shebang, but not cli full path
Submitted: 2004-04-12 18:11 UTC Modified: 2004-04-21 00:15 UTC
From: apc at guidoni dot com Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 4CVS-2004-04-12 (stable) OS: SCO_SV localhost 3.2 5.0.5 i386
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-04-12 18:11 UTC] apc at guidoni dot com
Description:
------------
php-4.3.5 does not compile; php4-STABLE-200404061630 
and php4-STABLE-200404122030 compile without problems.  

./configure --with-curl
stock php.ini
PHP 4.3.6RC4-dev (cli) (built: Apr 12 2004 14:16:24)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend 
Technologies

both snaps fail with shebangs and when calling the cli 
version with the filename as the argument, eg `php 
foobar.php'.

user@localhost 1% php abc.php
php: Segmentation violation -- Core dumped
user@localhost 2%

user@localhost 3% php ./abc.php
php: Segmentation violation -- Core dumped
user@localhost 4%

user@localhost 5% php ~/abc.php
hello world
user@localhost 6%

user@localhost 7% php /usr/user/abc.php
hello world
user@localhost 8%

--add the shebang #!/usr/local/bin/php to abc.php--
user@localhost 9% chmod u+x abc.php

user@localhost 10% ./abc.php
php: Segmentation violation -- Core dumped
user@localhost 11%

user@localhost 12% set path =(~/bin $path)
user@localhost 13% cp abc.php ~/bin
user@localhost 14% abc.php
hello world
user@localhost 15%

user@localhost 16% /usr/user/abc.php
hello world
user@localhost 17%

Reproduce code:
---------------
<?php
  echo "hello world\n";
?>

or

#!/usr/local/bin/php
<?php
  echo "hello world\n";
?>

Expected result:
----------------
hello world

Actual result:
--------------
user@localhost 6% php abc.php
php: Segmentation violation -- Core dumped
user@localhost 7% gdb /usr/local/bin/php core
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public 
License, and you are
welcome to change it and/or distribute copies of it 
under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show 
warranty" for details.
This GDB was configured as "i586-pc-sco3.2v5.0"...
Core was generated by `php'.
Program terminated with signal 11, Segmentation fault.
#0  0x80030232 in ?? ()
(gdb) 
(gdb) bt
#0  0x80030232 in ?? ()
#1  0x800a4cd0 in ?? ()
#2  0x800a4fb0 in ?? ()
#3  0x08104568 in php_execute_script 
(primary_file=0x8047d58) at /usr/user/php/php4-STABLE-
200404061630/main/main.c:1694
#4  0x08141ecd in main (argc=2, argv=0x8047d8c) at /
usr/user/php/php4-STABLE-200404061630/sapi/cgi/
cgi_main.c:1339
#5  0x08060dae in _start ()
(gdb) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-12 18:19 UTC] derick@php.net
This is just something broken in your system, it works fine here. Also, we are not really interested in debugging this for SCO Unix.
 [2004-04-12 18:43 UTC] apc at guidoni dot com
i am not sure what you mean by it works fine there.  do 
you have an sco os 5.0.5 box and the rest of the blah?  
i had no part of the decision to go with sco and would 
probably go with micro$oft before any sco product.  
with that aside, i just try to help the client, who was 
sold the sco solution by someone else.  will you please 
take a look at this?

i am not sure it is system based, looking at main.c and 
cgi_main.c, it looks like php is not able to build the 
argvs correctly, starting with argv[0] the scriptname.  
perhaps because of a broken getcwd??
 [2004-04-12 19:26 UTC] sniper@php.net
See bug #24457 and try the patch provided by Ilia. 

 [2004-04-21 00:15 UTC] iliaa@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 13 06:01:32 2024 UTC