Re: [PHP] system() Question
On Thu, Jan 1, 2009 at 12:01 AM, Daniel Brown danbr...@php.net wrote: On Thu, Jan 1, 2009 at 01:57, Jim Lucas li...@cmsws.com wrote: Getting in some practice for new little one? :) Damn kids ;-P Happy New Year to all, and to all a safe night! To you as well, Mr. Lucas! And now that I am done with work (for the most part), this is my official adieu to 2008. Thanks for the memories. merry new year to all you folks out there, wherever you hail from! -nathan
Re: [PHP] system() Question
Nathan Nobbe wrote: On Sun, Dec 28, 2008 at 8:40 PM, Micah Gersten mi...@onshore.com mailto:mi...@onshore.com wrote: Nathan Nobbe wrote: good point dan, and just to add further clarification, thats b/c the function specifies $return_var is passed by reference in the formal parameter. when you include the along w/ an actual parameter (during function invocation) thats referred to as call-time-pass-by-reference in php, and its typically frowned upon. in fact, i think its being removed from a future version of php. -nathan You don't call system using the ampersand. The reference is declared in the function definition. There's no reason for this to be frowned upon. well i dont think they deprecated it for shits--giggles. http://us.php.net/manual/en/language.references.pass.php its disabled by default in php.ini; wonder why.. ;) What you are referring to is the old PHP4 style of explicit pass-by-reference in function usage which is frowned upon. no im referring to call-time-pass by reference, which works just as well in php5; as long as you enable it in php.ini (or one of the other various ways). and also, for clarification, marking parameters as pass-by-reference works during method definition in php4 as well, of course. -nathan I think I was confused here about your response. After re-reading a few times, I see that you were enhancing Dan's response by explaining what call-time pass by reference is, not saying that the function is used that way. My apologies. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] system() Question
On Wed, Dec 31, 2008 at 7:03 PM, Micah Gersten mi...@onshore.com wrote: Nathan Nobbe wrote: On Sun, Dec 28, 2008 at 8:40 PM, Micah Gersten mi...@onshore.com mailto:mi...@onshore.com wrote: Nathan Nobbe wrote: good point dan, and just to add further clarification, thats b/c the function specifies $return_var is passed by reference in the formal parameter. when you include the along w/ an actual parameter (during function invocation) thats referred to as call-time-pass-by-reference in php, and its typically frowned upon. in fact, i think its being removed from a future version of php. -nathan You don't call system using the ampersand. The reference is declared in the function definition. There's no reason for this to be frowned upon. well i dont think they deprecated it for shits--giggles. http://us.php.net/manual/en/language.references.pass.php its disabled by default in php.ini; wonder why.. ;) What you are referring to is the old PHP4 style of explicit pass-by-reference in function usage which is frowned upon. no im referring to call-time-pass by reference, which works just as well in php5; as long as you enable it in php.ini (or one of the other various ways). and also, for clarification, marking parameters as pass-by-reference works during method definition in php4 as well, of course. -nathan I think I was confused here about your response. After re-reading a few times, I see that you were enhancing Dan's response by explaining what call-time pass by reference is, not saying that the function is used that way. My apologies. no worries -nathan
Re: [PHP] system() Question
On Wed, Dec 31, 2008 at 21:29, Nathan Nobbe quickshif...@gmail.com wrote: On Wed, Dec 31, 2008 at 7:03 PM, Micah Gersten mi...@onshore.com wrote: I think I was confused here about your response. After re-reading a few times, I see that you were enhancing Dan's response by explaining what call-time pass by reference is, not saying that the function is used that way. My apologies. no worries So help me God, if you two don't stop fighting, I'm going to turn this car around (;-P) -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] system() Question
Daniel Brown wrote: On Wed, Dec 31, 2008 at 21:29, Nathan Nobbe quickshif...@gmail.com wrote: On Wed, Dec 31, 2008 at 7:03 PM, Micah Gersten mi...@onshore.com wrote: I think I was confused here about your response. After re-reading a few times, I see that you were enhancing Dan's response by explaining what call-time pass by reference is, not saying that the function is used that way. My apologies. no worries So help me God, if you two don't stop fighting, I'm going to turn this car around (;-P) Getting in some practice for new little one? :) Happy New Year to all, and to all a safe night! -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] system() Question
On Thu, Jan 1, 2009 at 01:57, Jim Lucas li...@cmsws.com wrote: Getting in some practice for new little one? :) Damn kids ;-P Happy New Year to all, and to all a safe night! To you as well, Mr. Lucas! And now that I am done with work (for the most part), this is my official adieu to 2008. Thanks for the memories. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] system() Question
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 pResponse: , $response, /ppReturn Value: , $retval; The $retval is returning code 127 - Any ideas on why this? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] system() Question
On Sun, Dec 28, 2008 at 12:40 PM, Ryan O'Sullivan r...@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 pResponse: , $response, /ppReturn Value: , $retval; The $retval is returning code 127 - Any ideas on why this?http://www.php.net/unsub.php you might try shell_exec() instead to see if you can get any more mileage. the return value of shell_exec() is the output of the executed command. -nathan
Re: [PHP] system() Question
On Sun, Dec 28, 2008 at 12:40 PM, Ryan O'Sullivan r...@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 pResponse: , $response, /ppReturn 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 Pasottor...@niof.nethttp://www.niof.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] system() Question
On Sun, Dec 28, 2008 at 18:10, Rick Pasotto r...@niof.net wrote: 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. Actually, that's not entirely correct while the documentation shows it as a reference variable, it's not actually required to be a pointer. And in either case, the OP had the error code returned (127), and $retval would have nothing to do with causing the error. What I would recommend trying is: ?php exec('./gpsbabel -p -r -t -i gpx -f test.gpx -o kml -F test2.kml 21',$ret); print_r($ret); ? On a side note, I'm curious as to what 'gpsbabel' does. I've worked a bit with Keyhole markups and GIS overlays, etc. Neat stuff. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] system() Question
On Sun, Dec 28, 2008 at 6:49 PM, Daniel Brown danbr...@php.net wrote: On Sun, Dec 28, 2008 at 18:10, Rick Pasotto r...@niof.net wrote: 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. Actually, that's not entirely correct while the documentation shows it as a reference variable, it's not actually required to be a pointer. good point dan, and just to add further clarification, thats b/c the function specifies $return_var is passed by reference in the formal parameter. when you include the along w/ an actual parameter (during function invocation) thats referred to as call-time-pass-by-reference in php, and its typically frowned upon. in fact, i think its being removed from a future version of php. -nathan
Re: [PHP] system() Question
Nathan Nobbe wrote: good point dan, and just to add further clarification, thats b/c the function specifies $return_var is passed by reference in the formal parameter. when you include the along w/ an actual parameter (during function invocation) thats referred to as call-time-pass-by-reference in php, and its typically frowned upon. in fact, i think its being removed from a future version of php. -nathan You don't call system using the ampersand. The reference is declared in the function definition. There's no reason for this to be frowned upon. What you are referring to is the old PHP4 style of explicit pass-by-reference in function usage which is frowned upon. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] system() Question
On Sun, Dec 28, 2008 at 8:40 PM, Micah Gersten mi...@onshore.com wrote: Nathan Nobbe wrote: good point dan, and just to add further clarification, thats b/c the function specifies $return_var is passed by reference in the formal parameter. when you include the along w/ an actual parameter (during function invocation) thats referred to as call-time-pass-by-reference in php, and its typically frowned upon. in fact, i think its being removed from a future version of php. -nathan You don't call system using the ampersand. The reference is declared in the function definition. There's no reason for this to be frowned upon. well i dont think they deprecated it for shits--giggles. http://us.php.net/manual/en/language.references.pass.php its disabled by default in php.ini; wonder why.. ;) What you are referring to is the old PHP4 style of explicit pass-by-reference in function usage which is frowned upon. no im referring to call-time-pass by reference, which works just as well in php5; as long as you enable it in php.ini (or one of the other various ways). and also, for clarification, marking parameters as pass-by-reference works during method definition in php4 as well, of course. -nathan