Professional Web Applications Themes

Evalulating if an exec() call has worked? - PHP Development

I have finally sorted my probs with Imagemagick (looked at the Apache logs, saw the error in he path fixed it, what a great program it is) Now I want to be able to evaluate if an exec(); function has worked. if(!exec($imagemagick_path.mogrify -resize 150x150 $path_to_file) ) { print "Server says: Oh sod; I don't think I have permission to do that."; } else {print "Hell that worked out fine!";} But this doesn't do anything. It always seems to evaluate false. I thought it might give a true or false dependant upon the result of the command....

  1. #1

    Default Evalulating if an exec() call has worked?

    I have finally sorted my probs with Imagemagick (looked at the Apache logs,
    saw the error in he path fixed it, what a great program it is)

    Now I want to be able to evaluate if an exec(); function has worked.

    if(!exec($imagemagick_path.mogrify -resize 150x150 $path_to_file) )
    {
    print "Server says: Oh sod; I don't think I have permission to do
    that.";
    }
    else {print "Hell that worked out fine!";}

    But this doesn't do anything. It always seems to evaluate false. I thought
    it might give a true or false dependant upon the result of the command.

    Bonge Boo! Guest

  2. #2

    Default Re: Evalulating if an exec() call has worked?

    On Fri, 07 May 2004 18:30:00 +0100, Bonge Boo! <bingbongspamcop.net> wrote:
    >I have finally sorted my probs with Imagemagick (looked at the Apache logs,
    >saw the error in he path fixed it, what a great program it is)
    >
    >Now I want to be able to evaluate if an exec(); function has worked.
    >
    > if(!exec($imagemagick_path.mogrify -resize 150x150 $path_to_file) )
    > {
    > print "Server says: Oh sod; I don't think I have permission to do
    >that.";
    > }
    > else {print "Hell that worked out fine!";}
    >
    >But this doesn't do anything. It always seems to evaluate false. I thought
    >it might give a true or false dependant upon the result of the command.
    Why? That's not what the manual says it would do.

    [url]http://uk2.php.net/manual/en/function.exec.php[/url]

    You want the third argument. By convention, a zero exit status indicates
    success, non-zero indicates some form of error (and the exact value may be a
    process-specific reason code).

    --
    Andy Hassall <andyandyh.co.uk> / Space: disk usage ysis tool
    [url]http://www.andyh.co.uk[/url] / [url]http://www.andyhsoftware.co.uk/space[/url]
    Andy Hassall Guest

  3. #3

    Default Re: Evalulating if an exec() call has worked?

    I don't know the answer.
    "Bonge Boo!" <bingbongspamcop.net> schrieb im Newsbeitrag
    news:BCC18628.6D15C%bingbongspamcop.net...
    > I have finally sorted my probs with Imagemagick (looked at the Apache
    logs,
    > saw the error in he path fixed it, what a great program it is)
    >
    > Now I want to be able to evaluate if an exec(); function has worked.
    >
    > if(!exec($imagemagick_path.mogrify -resize 150x150 $path_to_file) )
    > {
    > print "Server says: Oh sod; I don't think I have permission to do
    > that.";
    > }
    > else {print "Hell that worked out fine!";}
    >
    > But this doesn't do anything. It always seems to evaluate false. I thought
    > it might give a true or false dependant upon the result of the command.
    >

    Der Andere Guest

  4. #4

    Default Re: Evalulating if an exec() call has worked?

    On 7/5/04 21:37, in article [email]hqsn90hafsrq843kj72fillpb7s97iunco4ax.com[/email],
    "Andy Hassall" <andyandyh.co.uk> wrote:
    >> But this doesn't do anything. It always seems to evaluate false. I thought
    >> it might give a true or false dependant upon the result of the command.
    >
    > Why? That's not what the manual says it would do.
    >
    > [url]http://uk2.php.net/manual/en/function.exec.php[/url]
    >
    > You want the third argument. By convention, a zero exit status indicates
    > success, non-zero indicates some form of error (and the exact value may be a
    > process-specific reason code).
    So I can make sense of the manual in future;

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

    Does the int return_var always means a zero or 1 will be returned and
    evalulated against? I'm afraid I really don't understand the shorhand used
    in the "definitions of the functions.

    It think its saying

    Exec ( my task to run, array to fill up with output, 0 or 1 depending on
    success of my task)


    Bonge Boo! Guest

  5. #5

    Default Re: Evalulating if an exec() call has worked?

    On Sat, 08 May 2004 18:56:55 +0100, Bonge Boo! <bingbongspamcop.net> wrote:
    >On 7/5/04 21:37, in article [email]hqsn90hafsrq843kj72fillpb7s97iunco4ax.com[/email],
    >"Andy Hassall" <andyandyh.co.uk> wrote:
    >
    >>> But this doesn't do anything. It always seems to evaluate false. I thought
    >>> it might give a true or false dependant upon the result of the command.
    >>
    >> Why? That's not what the manual says it would do.
    >>
    >> [url]http://uk2.php.net/manual/en/function.exec.php[/url]
    >>
    >> You want the third argument. By convention, a zero exit status indicates
    >> success, non-zero indicates some form of error (and the exact value may be a
    >> process-specific reason code).
    >
    >So I can make sense of the manual in future;
    >
    >string exec ( string command [, array output [, int return_var]])
    >
    >Does the int return_var always means a zero or 1 will be returned and
    >evalulated against? I'm afraid I really don't understand the shorhand used
    >in the "definitions of the functions.
    >
    >It think its saying
    >
    >Exec ( my task to run, array to fill up with output, 0 or 1 depending on
    >success of my task)
    Processes set an integer exit status; 0 is success, but any other value is
    failure, and it might not be 1. But it will be an integer.

    So you've nearly got it, but it's:

    exec(
    my task to run,
    array to fill up with output,
    integer to fill with 0 or non-zero depending on success of my task
    )

    --
    Andy Hassall <andyandyh.co.uk> / Space: disk usage ysis tool
    [url]http://www.andyh.co.uk[/url] / [url]http://www.andyhsoftware.co.uk/space[/url]
    Andy Hassall Guest

Similar Threads

  1. I don't know what else to do! Nothing has worked for me
    By Brenda2006 in forum Macromedia Flash Player
    Replies: 2
    Last Post: November 18th, 08:06 PM
  2. How is call exec("/usr/usr/bin -C $U2 &");
    By Mike in forum PHP Development
    Replies: 3
    Last Post: October 22nd, 08:14 PM
  3. executing multiple shell commands via one exec()-call
    By Falk Schneider in forum PHP Development
    Replies: 1
    Last Post: July 15th, 06:20 AM
  4. Replies: 0
    Last Post: December 10th, 09:27 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139