WHY "php bin/grav install" instead of "bin/grav install"

Hullo everyone and thank you for your work!

So I’ve installed Grav on Windows localhost with its build in webserver and php and symfony. Everything works fine but in step 3 of the installation “bin/grav server” didn’t work for me. As pointed out in this topic:

I put “php bin/grav server” and it worked.
In the aforementioned topic it is said that there seem to be two levels of nesting and therefore the php prefix is required.
May someone please point me in the direction of understanding this or be so kind and explain it further?
I understand nesting as a means to format code for better reading.

Thank you and kind regards

IIRC php ... is needed only on Windows. Don’t ask me about technicalities of this :sweat_smile:

@algatron, This hasn’t got much to do with Grav…

It’s because of the way Unix shell scripts work. In Unix shell scripts you can add in the first line of the script the program that should execute the script.

For PHP that would be:


If the bash shell should execute the script, the first line should be #!/bin/bash

A simple Google search would have solved the question: https://www.php.net/manual/en/features.commandline.usage.php See Example #1 Execute PHP script as shell script