I want to get the output of the command php -r 'echo get_cfg_var("some_var");'
to check it against a predefined value. Currently, I have the following code:
variableName := "default_mimetype"
cmd := exec.Command("php", "-r", "'echo get_cfg_var(\"" + variableName + "\");'")
out, err := cmd.CombinedOutput()
after running,
err.Error()
returns "exit status 254"
out
is "PHP Parse error: syntax error, unexpected end of file in Command line code on line 1"
What is causing this error? Am I not escaping something properly?