PHP scripts can be easily executed from the command-line interface (CLI). The syntax is as follows:
php filename.php
Here, filename refers to the file that contains scripts. The extension .php is needed alongside the filename.