return_values PHP

They have: 53 posts

Joined: Oct 2005

I have trouble understanding the meaning of the return_var in PHP.
I read that it is used in order to inform us if a PHP command has been executed.
I use system commands in PHP (like 'system', 'shell_exec' etc) and I can't find anywhere a list of the return_vars.
I mean that 0 is for 'OK, the command was executed'.
What does 1 stand for???
I execute a system command , I don't get any result, and if I ask PHP for the return_var, it says '1'.
Where could I find more info as to what return_var=1 means?

Busy's picture

He has: 6,151 posts

Joined: May 2001

0 and 1 are usually true and false

can you give us more of an example as to what your trying to do

They have: 53 posts

Joined: Oct 2005

Hi, thanx for your time.
My problem really has to do with WHAT the return values mean.
My problem is that I call an external program through PHP, using :
system ('program', $return_value);

I wanted to know if there is any kind of documentation saying perhaps that 'if you have $return_value=1, then it means that you have ... problem'.
I hope I am clear to you. i want to figure out WHY the program hasn't been called from PHP, so as to fix the problem if I can (if it has to do with permissions or whatever)..

They have: 11 posts

Joined: Jan 2004

The return value (or more correctly the exit value) is returned by the command/script/program when it finnished. In general, and exit value of 0 means the command ran correctly. Any other number returned means there was an error in the execution of you command. If the thing your running was well writen, then the exit value will mean something. Though the exact meaning of each exit value depends on the command that was run (the person who programed the script that you are running can set what the exit codes are for various faults.)

There are certain exit codes that are supposed to have reseved meaning. This page lists the reserved codes and their meanings. http://www.faqs.org/docs/abs/HTML/exitcodes.html#EXITCODESRE

For the meanings of other exit codes returned by you script, you will need to google pages for that command to find the true meaning.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.