Question: Say we usually it access via

```
http://localhost/index.php?a=1&b=2&c=3

```

How do we execute the same on a Linux command prompt?

```
php -e index.php

```

But what about passing the $\_GET variables? Maybe something like `php -e index.php --a 1 --b 2 --c 3`? I doubt that'll work.

Answer: 
Sometimes you don't have the option of editing the PHP file to set `$_GET` to the parameters passed in, and sometimes you can't or don't want to install php-cgi.

I found this to be the best solution for that case:

```
php -r '$_GET["key"]="value"; require_once("script.php");'

```

This avoids altering your PHP file and lets you use the plain `php` command. If you have php-cgi installed, by all means use that, but this is the next best thing. I thought this options was worthy of mention.

The `-r` means run the PHP code in the string following. You set the $\_GET value manually there, and then reference the file you want to run.

It's worth noting you should run this in the right folder, often, but not always, the folder the PHP file is in. 'Requires' statements will use the location of your command to resolve relative URLs, *not* the location of the file.
Or just (if you have [Lynx](https://en.wikipedia.org/wiki/Lynx_%28web_browser%29)):

```
lynx 'http://localhost/index.php?a=1&b=2&c=3'

```