php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7287 "exec() or die", dies on success
Submitted: 2000-10-17 12:37 UTC Modified: 2000-12-07 23:59 UTC
From: seth at the-hub dot com Assigned:
Status: Closed Package: *Function Specific
PHP Version: 4.0.3pl1 OS: linux
Private report: No CVE-ID: None
 [2000-10-17 12:37 UTC] seth at the-hub dot com
i wrote a script with something like the following:

exec("touch somefile") or die("couldnt create file!");

and it worked fine in php 4.0.1

but when i upgraded to 4.0.2 the exec kept dying even though there was no error.

when i upgraded to 4.0.3 it still did not work.

i've also tried replacing exec() with a system() call and that did not help.

note: permissions have not changed on any dirs so that's not the problem, and exec doesn't return any errors (or any output at all for that matter) into the error array or anywhere else

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-07 23:59 UTC] jason@php.net
This inteded function of exec.

string exec (string command [, string array [, int return_var]])

You need to test return_val which will be the error condition.

ex.

exec("touch hi",,$err); if ($err) die("Could not create file");

-jason

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Mar 25 14:01:26 2019 UTC