Reputation: 79
proc_open() has been disabled for security reasons
I'm with free hosting at the moment (Hostinger) - Making a personal site for my use only and a few others.
I know I am supposed to remove the proc_open
from the php.ini but I can't access it due to my shared hosting plan.
The code surrounding the proc_open
in my code is as follows - If you require the full code please let me know. I've tried commenting parts out but it returns errors.
All I want is to remove it and allow for the code to run fine.
<?php
// 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;
}
Upvotes: 5
Views: 40990
Reputation: 29
I solved my problem by editing this file vendor->facade->ignition->config->flare.php line 29
'collect_git_information' => true, <---- Change this value to false
Laravel 6
PHP 7.3
Upvotes: 2
Reputation: 4518
You may try to overwrite default php.ini. In the past, I used to successful with another share host, follow this step
You create your own php.ini in your web folder. No need to have all value in php.ini, just something you want to overwrite. For example your php.ini may only have one line like this
disable_functions = exec,execl,system,passthru,shell_exec,set_time_limit,escapeshellarg,escapeshellcmd,proc_close,ini_alter,proc_open,dl,popen,show_source,posix_getpwuid,getpwuid,posix_geteuid,posix_getegid,posix_getgrgid,open_basedir,safe_mode_include_dir,pcntl_exec,pcntl_fork,putenv,proc_get_status,proc_nice,proc_terminate,pclose,virtual,openlog,popen,pclose,virtual,openlog,escapeshellcmd,escapeshellarg,dl,show_source,symlink,eval,mail
Remember to remove proc_open from disable functions
Create .htaccess and add this
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/user/public_html
</IfModule>
Remember to change /home/user/public_html with your path
Upvotes: 4