If you want to run php script in shell, simply put the following line at the beginning of your php file.
#!/path/to/php is the path you installed php in linux. If you don’t know where php is installed in your linux. Type the following command
This will output the php path from your linux. The output will be something like this
For example: hello.php
#!/usr/bin/php <?php echo "Hello World!"; ?>
Make your php script executable by typing
chmod +x hello.php
And then run it