|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11023 exec does not wait for completion of cmd
Submitted: 2001-05-22 13:14 UTC Modified: 2002-01-12 06:47 UTC
From: terry at advertwizard dot com Assigned:
Status: Closed Package: Program Execution
PHP Version: 4.0.5 OS: slackware 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: terry at advertwizard dot com
New email:
PHP Version: OS:


 [2001-05-22 13:14 UTC] terry at advertwizard dot com
$cmd = "mv " . SITES_IMP . "site_* " . DB_UPDATES;

$arr = array();
$cmd = "ls " . DB_UPDATES . " site_* | wc -l";

i am of the impression that code proceeding an exec cmd will not execute until the exec is finished

in the above instance, the "ls" exec is executing before the "mv" exec has finished - when i know that 10 files have been moved, the "ls" exec returns 0 for a "wc -l", when running the code again it returns the number of files correctly - have placed sleeps between the commands and all works well

wondered if this is a bug in the exec cmd or my misunderstanding of its use


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-22 07:04 UTC]
Does this happen on 4.1.0?

 [2002-01-12 06:47 UTC]
No feedback, closing.
 [2004-02-09 16:56 UTC] lars at erhardsen dot dk
I think, I have a similar problem.

The scenary is: Linux 2.4.22, Apache 2.0.48, PHP 4.3.4 on a Pentium 4, 2.4ghz, 512 mb ram

The page continues without the 'output' from exec thus leaving an incomplete page. If I press f5/refresh, some times it works, other times it does not work.

I have also placed sleeps between commands to ensure it works well.

My php config: 
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-gd=/usr/local --with-pdflib=/usr/local --with-mysql --with-config-file-path=/etc/apache2 --with-session --with-zlib-dir=/usr --with-png-dir=/usr/lib --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-tiff-dir=/usr --with-system-regex=yes --enable-debug=no --with-xml --with-imap-ssl=/usr/local/imap-2002d --enable-exif --with-openssl --with-gettext --enable-ftp --enable-sysvsem --enable-sysvshm --enable-calendar --enable-bcmath --enable-sockets --enable-track-vars --with-mcrypt --enable-gd-native-ttf --enable-mbstring --enable-gd-native-ttf

My Apache config:
./configure --enable-ssl --enable-rewrite --enable-so --enable-info --enable-suexec --with-suexec-caller=nobody --enable-dav  --enable-deflate
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 18:01:28 2024 UTC