Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Installation & Hosting

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

Solved by pamtbaau View solution

Started by T Tree 2 years ago · 2 replies · 249 views
2 years ago

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:
/forum/archive/please-run-bin-grav-install-i-cannot-get-it-to-work-iis-8-on-w2012r2-srv-t2440?u=algatron
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.

binGravServerQuestion|690x301

Thank you and kind regards
Tom

last edited 03/06/24 by T Tree
2 years ago

IIRC php ... is needed only on Windows. Don't ask me about technicalities of this 😅

2 years ago Solution

@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:

PHP
#!/usr/bin/php
<?php
var_dump($argv);
?>

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

Suggested topics

Topic Participants Replies Views Activity
Installation & Hosting · by antoinep, 16 hours ago
5 62 10 hours ago
Installation & Hosting · by Jürgen Dietrich, 7 months ago
0 63 7 months ago
Installation & Hosting · by rappluk, 8 months ago
0 63 8 months ago
Installation & Hosting · by N, 12 months ago
3 74 12 months ago
Installation & Hosting · by Youle, 1 year ago
1 62 1 year ago