After misunderstanding, I finally got what you are trying to do. You should check your server configuration files; are you using apache2 or some other server software?
Look for lines that start with LoadModule php
...
There probably are configuration files/directories named mods
or something like that, start from there.
You could also check output from php -r 'phpinfo();' | grep php
and compare lines to phpinfo();
from web server.
php
interactively:(so you can paste/write code in the console)
php -a
php -f file.php
php -f file.php > results.html
To run only small part, one line or like, you can use:
php -r '$x = "Hello World"; echo "$x\n";'
If you are running linux then do man php
at console.
if you need/want to run php through fpm, use cli fcgi
SCRIPT_NAME="file.php" SCRIP_FILENAME="file.php" REQUEST_METHOD="GET" cgi-fcgi -bind -connect "/var/run/php-fpm/php-fpm.sock"
where /var/run/php-fpm/php-fpm.sock is your php-fpm socket file.