Re: system() Question
| From: | Rick Pasotto | Date: | Sun, 28 Dec 2008 23:10:03 +0000 |
| Subject: | Re: system() Question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285168@lists.php.net to get a copy of this message | ||
On Sun, Dec 28, 2008 at 12:40 PM, Ryan O'Sullivan <rjo@rynet.com> wrote:
> Hello all,
>
> I am using system to convert some files using a binary in linux. My code
> looks like this:
> $response = system('gpsbabel -p "" -r -t -i gpx -f "test.gpx" -o
> kml -F "test2.kml"', $retval);
> echo "<p>Response: ", $response, "</p><p>Return Value:
> ", $retval;
>
> The $retval is returning code 127 - Any ideas on why this?
You overlooked the ampersand in front of $retval. The syntax for
'system' is:
string system ( string $command [, int &$return_var ] )
You have to pass a pointer to the variable, not the variable itself.
--
"Paper has a genius for multiplication that cannot be equaled anywhere
else in nature." -- Hugh Keenleyside
Rick Pasotto rick@niof.net http://www.niof.net