shell - PHP-FPM exec results different from commandline -
i'm facing unusual problem : have php script doing
<?php exec('sudo /bin/ps aux', $output, $retval) ?> <pre><?php print_r($output); ?></pre> <?php echo $retval; ?>
the /bin/ps command permitted launched vith sudo (/etc/sudoers) :
tv25 xxxxxx.ovh.net=(root) nopasswd:/bin/ps
this simple script, (verify processes launched root still running) have 2 differents outputs depending on environment :
if log in scheme user tv25 , launch script (php script.php) command line, exrything works expected. if launch script page (apache + php-fpm, running user tv25), $ouput empty array, , $retval equals 1.i have tried indicate total path of ps , of sudo, works. tried prefix command valid shell (/bin/sh), doesn't solve.
forinformation, exec function allowed in php.ini.
thanks help,
jérémie
try taking off sudo (worked me), should have running doing follows:
<?php exec('ps aux', $output, $retval); ?> <pre><?php print_r($output); ?></pre> <?php echo $retval; ?>
php shell
No comments:
Post a Comment