Another nice thing about Linux is that you don’t need to use a program command to execute a PHP script, if you have the PHP-CLI version installed.
On Windows and for a while on Linux, I used:
php -f myscript.php
This is perfectly fine, but this executable file method is best for simple tool-scripts that you want to run manually on your system.
All you need to do is include this line on the very first line of your PHP file:
Note that you still need to use the <?php ?> tags, but they go after that line.
Once you edited your script, you make it executable:
chmod +x myscript.php
And to run it you go to your script’s path and use this: