Page 1 of 1

No output from passthru() function

Posted: Fri Jan 08, 2010 7:00 pm
by dcinadr
Here is my code:

Code: Select all

 
ob_start();
passthru ($linuxCommand);
$rawXml = ob_get_contents();
ob_end_clean();
$xmlParser = xml_parser_create();
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parse_into_struct($xmlParser, $rawXml, $vals, $index);
xml_parser_free($xmlParser);
return $vals;
 
My problem is the output from passthru($linuxCommand) is empty. Nothing is being output. However, when i run the exact same code in the php cli everything works fine. Why would i be getting an empty string when i run this code through the browser?

Re: No output from passthru() function

Posted: Sat Jan 09, 2010 11:44 am
by cpetercarter
Possibly passthru() is disabled in the php.ini file.

Re: No output from passthru() function

Posted: Sat Jan 09, 2010 11:56 am
by AbraCadaver
The $linuxCommand is most likely failing because of permission issues or some other reason:

Code: Select all

passthru ($linuxCommand, $return);
echo $return;