S
S
Sergei Iamskoi2016-04-01 17:40:37
linux
Sergei Iamskoi, 2016-04-01 17:40:37

How to properly start a process from PHP?

Bundle of Nginx + php-fpm
In php I execute the command:


$exc = 'openssl smime -verify -inform PEM -nointern -certfile ' . $this->_getPublicKey() . '-CAfile' . $this->_getPublicKey() . '-in' . $fileInName .$
exec($exc);

Warning is poured into the php5-fpm.log log file:
[01-Apr-2016 17:36:45] WARNING: [pool www] child 14651 said into stderr: "Verification successful"

Verification successful is the result of openssl. In theory, exec (or system($exec, $result) ) should give the output of the process as a result, but in reality the result gets into php-fpm and it swears in the log (as I understand the mechanism for the appearance of this log). Tried to execute the process in different ways:
system, exec, passtrh, passthru - all the same. How to get rid of this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
magazovski, 2016-04-02
@syamskoy

You clearly wrote said into stderr . This means your command is writing to the wrong thread .
To redirect stderr to stdout , add 2>&1 at the end of the command .
To redirect anywhere: 2>/dev/null

C
chupasaurus, 2016-04-01
@chupasaurus

nohup first add, unhook process

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question