Someone on chat asked me what switches he had to use to execute php on the command-line. He tried to execute a php script, and all the command returned was the contents of the script, instead of executing it.

At least, that was what he claimed. I don’t use php on the cli a lot, so just to be sure I wrote a quick test script, which executed flawless.

So I took a look at the script he tried to execute:

echo html_entities_decode(file_get_contents($argv[0]));

So the script did exactly what was asked ;) outputting the content of the script itself, instead of outputting the content of the file given as 1st argument to the script.

hi hi.
He overlooked the fact that the 0-key of the argv array holds the name of the script itself, instead of the 1st argument given on the cli :)