Forum Moderators: phranque
sh: /openssl: No such file or directory Configure Command: --with-openssl OpenSSL support: enabled OpenSSL Version: OpenSSL 0.9.8b /var/lib/php/session/ until I ran chown -R domainuser:psacln, could user permissions also be why I can't use openssl? /usr/bin and openssl is in there. proc_open to see if there were any pointers, I've even read every post here on openssl – everything seems so broad, I need to narrow it down a bit, I'm under a lot of pressure to get this working and I'm not sure where to start trying to troubleshoot this specific issue, the server is practically a default install, do I need to add or change anything in Config files to make openssl work? Maybe it's not accessble from PHP running as a cgi?
function saveOrder($an_order)
{
global $config_openssl_path;
global $config_orders_path;
$descriptorspec = array(
0 => array("pipe", "r"),// stdin is a pipe that the child will read from
1 => array("pipe", "w"),// stdout is a pipe that the child will write to
2 => array("file", $config_orders_path."/error.txt", "a") // stderr is a file to write to
);
$order_data = $an_order->outputOrderFile();
$order_name = $config_orders_path.time()."".(rand()%1000);
$cwd = getcwd()."/";
$pem_in_file = $cwd.$config_orders_path."/public.pem";
$key_out_file = $cwd.$order_name.".key";
$data_out_file = $cwd.$order_name.".dat";
$encryptionPassword = generateRandomPassword(22);
//encrypt the password with public.pem
$encryptCommand = $config_openssl_path." rsautl -encrypt -inkey ".$pem_in_file." -pubin -out ".$key_out_file;
$process = proc_open($encryptCommand, $descriptorspec, $pipes);
$error = true;
if( is_resource($process) ){
fwrite($pipes[0], "$encryptionPassword\n");
fclose($pipes[0]);
fclose($pipes[1]);
$return_value = proc_close($process);
if( $return_value == 0 ){
// encrypt the data
$encryptCommand = $config_openssl_path." des3 -salt -pass pass:".$encryptionPassword." -out ".$data_out_file;
$process = proc_open($encryptCommand, $descriptorspec, $pipes);
if( is_resource($process) ){
fwrite($pipes[0], $order_data);
fclose($pipes[0]);
fclose($pipes[1]);
$return_value = proc_close($process);
}
}
}
}