proc_open() has been disabled for security reasons
我现在正在免费托管(Hostinger) – 创建一个仅供我使用的个人网站和其他一些网站.
我知道我应该从php.ini中删除proc_open,但由于我的共享主机方案,我无法访问它.
我的代码中proc_open周围的代码如下 – 如果您需要完整代码,请告诉我.我试过评论部分,但它返回错误.
我想要的只是删除它,并允许代码运行正常.
// Initializing
if (!isset($ACCOUNTS)) $ACCOUNTS = array();
if (isset($USER) && isset($PASSWORD) && $USER && $PASSWORD) $ACCOUNTS[$USER] = $PASSWORD;
if (!isset($HOME_DIRECTORY)) $HOME_DIRECTORY = '';
$IS_CONFIGURED = count($ACCOUNTS) >= 1 ? true : false;
// Command execution
function execute_command($command) {
$descriptors = array(
0 => array('pipe', 'r'), // STDIN
1 => array('pipe', 'w'), // STDOUT
2 => array('pipe', 'w') // STDERR
);
$process = proc_open($command . ' 2>&1', $descriptors, $pipes);
if (!is_resource($process)) die("Can't execute command.");
// Nothing to push to STDIN
fclose($pipes[0]);
$output = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$error = stream_get_contents($pipes[2]);
fclose($pipes[2]);
// All pipes must be closed before "proc_close"
$code = proc_close($process);
return $output;
}