No output from passthru() function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dcinadr
Forum Newbie
Posts: 12
Joined: Fri Jan 08, 2010 4:15 pm

No output from passthru() function

Post 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?
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: No output from passthru() function

Post by cpetercarter »

Possibly passthru() is disabled in the php.ini file.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: No output from passthru() function

Post by AbraCadaver »

The $linuxCommand is most likely failing because of permission issues or some other reason:

Code: Select all

passthru ($linuxCommand, $return);
echo $return;
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply