REX: Remote Execution Framework for PHP
<< Framework Options Back to Contents Web Interface >>

Command Line Interface

The REX executor (rex.php) offers a Command-Line Interface (CLI) to fetch and execute remote code.

$ php rex.php

The above instructs REX to fetch the code from and execute it displaying any output to the screen.

In addition to the file (or files) specified there are a number of switches and options you can provide.

These control the settings detailed in the framework options section of the documentation.

CLI Switches and Options

REX Stack and Environment Variables

The CLI can be used to specify REX stack variables and REX environment variables on startup.

Note that both the variable names and values can be quoted strings if required to include data with spaces.


Anything passed and not prefixed with -- will be treated as a filename to be loaded into the list for execution. These are done in order.

Please note however that the options are set once at runtime and not parsed in order with the filenames so, for example, if you call a filename then set the base and then call another filename both will have the base set when executed.


$ php rex.php --debug=1 http://codeserver/rex/
Will execute the file http://codeserver/rex/index.rex with debug output

$ php rex.php --base="http://codeserver/my files/" code1.rex code2.rex
Will execute first code1.rex then code2.rex from the directory "http://codeserver/my files/"

$ php rex.php --set somevar="something or other" --default=rexcode.php http://codeserver/rex/
Will set the variable somevar to be "something or other" in the variable stack and then execute http://codeserver/rex/rexcode.php

<< Framework Options Back to Contents Web Interface >>