proc_open() path problem
i'm using linux and php 5.2.12
i have problem with executing proc_open
if i use
proc_open('php script.php', $descriptorspec, $pipes);
it will show me error
sh: /php: No such file or directory
if i use
proc_open('/usr/bin/php script.php', $descriptorspec, $pipes);
or
proc_open('php script.php', $descriptorspec, $pip开发者_运维知识库es, '/usr/bin/');
it still show me same error.
i have no idea why it always append slash in front of command.
any help please?
thanks!
If you don't want to turn off safe-mode completely, just set this in your php.ini file
safe_mode_exec_dir = "/usr/bin"
Try doing:
$php = trim(shell_exec('type -P php'));
if (empty($php) !== true)
{
proc_open($php . ' /path/to/your/script.php', $descriptorspec, $pipes);
}
else
{
die('Install php-cli!');
}
精彩评论