I have a linux command line that I need to execute witin either PHP or Javascript (PHP preferred.)
The command is keygen AB3554C1D1971DB7 \pc_code 365
However, I would like to substitute the \pc_code with a string like $pccode where user enters the generated PC Code. This is for a legit project, but having a problem with creators of the program giving me assitance.
It could be that this program is poorly written and outputs its information to stderr instead of stdout. Or it could be that it is failing and (properly) printing the error message to stderr. In either case, shell_exec wouldn’t capture stderr. However, you should be able to capture stderr by adding “
2>&1” to the end of your command, i.e.:Edit: For continuity’s sake, what fixed the problem was something mentioned in a comment to another answer below: