If you are running the script
from the command line, there are two distinct ways to do it:
- Run the php command and specify as the first parameter the name of the file that you want to run.
- Make the file 'executable,' and on the first line add a "shebang" line such as: #!/usr/env php. (Use the command, which env to find out exactly where the env command is located on your machine.) Now, you can simply "run" the script: the shell will find the "shebang" line and thus know which programming language to invoke.
If you want to run the command in a web server such as PHP or nginix, then ...
"just Google it." Which might find you hits like these: