|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24605 Scripts Dont Exit, Forced Only
Submitted: 2003-07-11 09:43 UTC Modified: 2003-07-20 11:12 UTC
From: Assigned: nathan (profile)
Status: Not a bug Package: CGI/CLI related
PHP Version: 5CVS-2003-07-17 (dev) OS: Cobalt Linux
Private report: No CVE-ID: None
 [2003-07-11 09:43 UTC]
Scripts do not exit after processing code.

Reproduce code:

print "test";


chmod 755 it, and execute.

Expected result:
Script should print "test" and exit.

Actual result:
Echoes text, with a delay, but then doesnt exit, just sits active with no feedback/errors.

Waited 2minutes, script still didnt close gracefully.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-11 11:13 UTC]
Works fine here.

 [2003-07-11 22:14 UTC]
Turns out the scripts do stop, just very delayed. Not sure on the cause.
 [2003-07-18 03:39 UTC]

Sorry to reopen this, but ive tried the latest snaps again, and it seems the scripts still take a long time to close. Is there anything I can try to get some debugging information to find out why? I just want to help find a solution where i can :)
 [2003-07-18 03:46 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

Start giving proper information..

 [2003-07-18 09:49 UTC]


PHP Version => 5.0.0b2-dev

System => Linux 2.2.16C37_III #1 Sat Apr 12 14:54:32 PDT 2003 i586
Build Date => Jul 18 2003 08:31:18
Configure Command =>  './configure' '--prefix=/home/php5' '--with-zlib-dir=/usr/local/zlib' '--with-libxml-dir=/home/libxml2' '--disable-cgi' '--enable-cli' '--with-snmp=/home/ucd-snmp' '--with-gd' '--enable-sockets' '--enable-exif' '--without-pear' '--with-mysql=/home/mysql4' '--with-mysql-sock=/tmp/mysql4.sock'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /home/php5/lib
PHP API => 20030518
PHP Extension => 20020429
Zend Extension => 90021012
Debug Build => no
Thread Safety => disabled
Registered PHP Streams => php, http, ftp, compress.zlib  

That should be enough information.

I wrote a script containing, <?php phpinfo(); ?>.

After executing this script, it gave me the phpinfo information required, but then stopped. At this point the process should have stopped, whereas it just left me there as if the process was still running. If I force exit it, the process closes. If I wait about 2-3 minutes, the process closes itself after a while.

This happens on any script running, phpinfo() being an example.

 [2003-07-19 08:28 UTC]
can not reproduce, must be something wrong in your system/compiler/etc. 

 [2003-07-19 08:28 UTC]
Try: ./configure --disable-all --disable-cgi 
And run the script: sapi/cli/php -n test.php

 [2003-07-19 20:54 UTC]

Just tested what you had in mind Sniper, and that worked, everything runs no problems...

Ill go through module by module and try find which one it is causing the slow execution.

 [2003-07-20 02:59 UTC]
Keep it bogus in the mean time please.
 [2003-07-20 05:44 UTC]
Actually I was asking for feedback. :)

 [2003-07-20 09:57 UTC]
Ok...after some testing, realised its an extension causing the lag. After some experimenting, I came to this...

Working configure - ./configure --prefix=/home/php5test --disable-cgi --with-libxml-dir=/home/libxml2 --disable-pear --disable-dom --disable-simplexml

A test script, with phpinfo() was executed, and the process stopped immediately after processing.

Next configure - ./configure --prefix=/home/php5test --disable-cgi --with-libxml-dir=/home/libxml2 --disable-pear --disable-dom

With simplexml enabled, I tried executing the script again, and it waited at least a minute before I forcefully stopped the process.

I am using a PHP snapshot from 20/07/03 at 1130GMT, with libxml2 2.5.8 installed in /home/libxml2.
 [2003-07-20 11:12 UTC]
Can not reproduce with those options either
and you're using too old sources.

 [2003-08-03 11:26 UTC] fieml at service dot at
having the same problem here with
- php5-200308031530
- libxml 2.5.8
- linux 2.4.19-xfs
- gcc 2.95.3

using the same php info-script <? phpinfo(); ?> as in the report by nathan php just hangs after executing it. starting it as apache module makes the httpd hanging on startup (before it produces any childs).

the problem disappears when disabling dom and simplexml.
 [2003-08-13 15:42 UTC] baobabs at sveiks dot lv
The same problem here, with the newest CVS sources.

php version: php5-200308131730
configure options: ./configure --with-mysql --enable-fastcgi --disable-simplexml
kernel: Linux ap2 2.4.21ctxsmp-17a #1 Fri Aug 8 13:42:52 EEST 2003 i686 unknown
gcc: 2.95.4


# cat xxx.php 
<? print "test\n"; ?>
# /usr/lib/cgi-bin/php xxx.php 
Content-type: text/html
X-Powered-By: PHP/5.0.0b2-dev


 [2003-08-13 16:07 UTC] romans at gentoo dot org
notice, that mostly all was using gcc2. Here are some more 
here are results from debian 
gcc version 2.95.4 20011002 (Debian prerelease) 
(gdb) run xxx.php 
Starting program: /usr/lib/cgi-bin/php xxx.php 
[New Thread 1024 (LWP 15635)] 
Content-type: text/html 
X-Powered-By: PHP/5.0.0b2-dev 
Program received signal SIGINT, Interrupt. 
[Switching to Thread 1024 (LWP 15635)] 
0x4023bd2f in free () from /lib/ 
(gdb) info stack 
#0  0x4023bd2f in free () from /lib/ 
#1  0x4023baa3 in free () from /lib/ 
#2  0x081467b0 in zend_hash_destroy (ht=0x81d0090) at 
#3  0x08141cf6 in zend_shutdown () at 
#4  0x08118e02 in php_module_shutdown () at 
#5  0x0817d549 in main (argc=2, argv=0xbffffde4) at 
#2  0x081467b0 in zend_hash_destroy (ht=0x81d0090) at 
518                     pefree(q, ht->persistent); 
(gdb) list 
513                             ht->pDestructor(q->pData); 
514                     } 
515                     if (!q->pDataPtr && q->pData) { 
516                             pefree(q->pData, 
517                     } 
518                     pefree(q, ht->persistent); 
519             } 
520             pefree(ht->arBuckets, ht->persistent); 
(gdb) print *q 
$4 = {h = 1647256011, nKeyLength = 16, pData = 0x81d2c18, 
pDataPtr = 0x0, pListNext = 0x81d2c90, 
  pListLast = 0x81d2b28, pNext = 0x0, pLast = 0x0, arKey = 
(gdb) print *ht 
$5 = {nTableSize = 1024, nTableMask = 1023, nNumOfElements 
= 42, nNextFreeElement = 0, 
  pInternalPointer = 0x81d1028, pListHead = 0x81d1028, 
pListTail = 0x81d2c90, arBuckets = 0x81ff558, 
  pDestructor = 0x813bf40 <destroy_zend_function>, 
persistent = 1 '\001', nApplyCount = 0 '\0', 
  bApplyProtection = 0 '\0'} 
(gdb) print *ht->arBuckets 
$7 = (Bucket *) 0x0 
gdb) up 
#3  0x08141cf6 in zend_shutdown () at 
687             zend_hash_destroy(GLOBAL_FUNCTION_TABLE); 
(gdb) list 
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); 
683     #endif 
685             zend_destroy_rsrc_list_dtors(); 
687             zend_hash_destroy(GLOBAL_FUNCTION_TABLE); 
688             zend_hash_destroy(GLOBAL_CLASS_TABLE); 
691             free(GLOBAL_AUTO_GLOBALS_TABLE); 
running strace ends up here: 
write(1, "X-Powered-By: PHP/5.0.0b2-dev", 29X-Powered-By: 
PHP/5.0.0b2-dev) = 29 
write(1, "\r\n", 2 
)                     = 2 
write(1, "\r\n", 2 
)                     = 2 
write(1, "test\n", 5test 
)                   = 5 
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 
0}}, NULL) = 0 
this have nothing to do with gentoo, php runs fine there. 
anything else i can test?
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Aug 09 18:34:40 2020 UTC