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, $pipes, '/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!
hakre
200k55 gold badges454 silver badges868 bronze badges
2 Answers 2
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!');
}
answered Jan 25, 2010 at 4:39
Alix Axel
155k100 gold badges406 silver badges509 bronze badges
Comments
lang-php
which phpfrom the commandline?