There are many ways of executing a PHP script. For example you might run it directly from a command line:
Other option, readily available for tesing since PHP 5.4, is to spin up the internal PHP server and see the result in a browser:
php -S localhost:3000
If you create a simple page with the function php_sapi_name you will be able to check out the interface that is being used to run the script.
In the first case the out put should be “cli” in the second one “cli-server”. If you run the file on a server it could output “apache2handler” or something similar if you’re using Apache server.