We just have to run the PHP CLI (Command-line Interface) program and provide the PHP script file name as the command-line argument, for example, php myScript.php, assuming php as the command to invoke the CLI program.
We have to keep in mind that if our PHP script is written for the Web CGI interface, it may not execute properly in the command-line environment.
If you are looking forward to becoming an expert in Web Development, make sure to check out Intellipaat’s Web Development Online Course. Here, you can learn all of the concepts thoroughly and earn a course certificate as well!