Run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument.
To run php interactively: (so you can paste/write code in the console)
To make it parse file and output to console:
php -f file.php
Parse file and output to another file:
php -f file.php > reults.html
Do you need something else? To run only small part, one line or like, you can use:
php -r '$x = "Slightbook"; echo "$x\n";'
If you are running linux then do man php at console.