The standard "php" binary cannot do this but if you don't already have it install "php-cgi"
apt install php-cgi
php-cgi yourscript.php "somevar=something&anothervar=anotherthing"
Just use the php-cgi binary, pass it your .php and then in quotes put the normal query string and you will get the same output as the web browser would produce.........
This example is based on Wordpress but applies to any other query string eg.
http://wordpress.com/?p=55
If you want to manually redirect that p=55 to /some/other/url how do you do it?
RewriteCond %{QUERY_STRING} p=55 [NC]
RewriteRule .* /new-url/? [R=301,L]
You can change the p=55 to whatever your query string looks like.
Remember to keep the "?" at the end of the new URLunless you really want the query s........