T
T
tonybeat2020-04-09 17:35:43
linux
tonybeat, 2020-04-09 17:35:43

Why is the openssl command not executed in exec?

Please tell me, through the console I run the command in the desired folder

openssl pkcs7 -inform DER -outform PEM -in OpisDokumUL_f723730f2b35416385a2e01f33295478.xml.zayav_1.p7s -print_certs > x509cer.pem

everything is OK, it works,

but then I try to execute the same command in the same folder, but not through the console, and through

$command = 'openssl pkcs7 -inform DER -outform PEM -in OpisDokumUL_f723730f2b35416385a2e01f33295478.xml.zayav_1.p7s -print_certs > x509cer.pem';
exec($command, $output, $resultCode);

but it does not work for some reason, although before that all exec commands work, the

absolute path was prescribed for openssl, shel_exec tried.
no result at all

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nokimaro, 2020-04-09
@tonybeat

such magic will reveal all the secrets,
but I suspect there are no write rights to x509cer.pem
upd. specify the full path to x509cer.pem (from the server root) or cd before calling openssl

$command = 'cd /нужная/папка/ && openssl pkcs7 ....'

upd2. the path to the .p7s file is also better to specify the full
$command = 'openssl pkcs7 -inform DER -outform PEM -in OpisDokumUL_f723730f2b35416385a2e01f33295478.xml.zayav_1.p7s -print_certs > x509cer.pem 2>&1';
exec($command, $output, $resultCode);

var_dump($output);

var_dump($resultCode);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question