php

php inspects the active PHP runtime—version, SAPI, extensions and searchable phpinfo data—and keeps code execution behind explicit eval and file forms.

DevelopmentVersion 1.2.2Stable
lil-terminal

Overview

Diagnostics are the default; execution is not. Use the short summary or filtered phpinfo to understand the hosting environment, and move to php eval ... or php file ... only when running code is the deliberate next action.

Inspect first, execute explicitly

php, php version and php modules only inspect the runtime. php info memory -c narrows configuration data. php eval ... and php file ... execute with the permissions of the PHP process, so review the code exactly as you would before running a script on the server.

Syntax

lil-terminal
php [info|version|modules|eval|file] ...

Reference

php

show a concise PHP runtime summary

php info [query] [options]

show structured phpinfo data and optionally filter rows

php version

show PHP version, SAPI and binary

php modules [filter]

show loaded PHP extensions and optionally filter their names

php eval <code>

execute inline PHP code

php file <path>

execute one PHP file

-g

phpinfo general section

-c

phpinfo configuration section

-m

phpinfo modules section

-e

phpinfo environment section

-v

phpinfo variables section

-C

phpinfo credits section

-l

phpinfo license section

-a

all phpinfo sections

Inspecting the runtime

php includes the PHP version, SAPI, operating-system family, binary, Zend version, loaded configuration file and module count. php version is shorter. php modules json filters extension names, while php info memory -c keeps configuration groups and rows containing the query.

Execution boundary

php eval <code> is the only inline-code form; php file <path> executes one PHP file. Syntax is parsed before execution and exit/halt tokens are blocked. Execution time is limited to about five seconds and captured output is capped at 1 MiB.

Running code is not a sandbox

The executed code runs with the permissions of the hosting PHP process. Inspect it first, use a test copy when appropriate, and treat filesystem, network and database operations exactly as you would in any server-side PHP script.

Interactive sandbox preview

Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.

Execute one PHP file

Install and manage

Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.

Base and Minimum are two packages of the same current module release, not separate command versions.

Base package

Install the complete package with local command reference and every published mode.

install php
Minimum package

Install the reduced package. Local reference is omitted; help <cmd> -i opens the current server reference.

install php -m
Exact public version

Install exactly this published version.

install php -v 1.2.2
Check or update

Ask upgrade to check compatibility and replace the installed block only when needed.

upgrade php
Remove module

Remove the extension block while leaving the core and unrelated modules intact.

install php -u

Examples

Examples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.

Execute one PHP file
cd \sandbox | php file scripts/php-demo.php | php modules json
sandbox

{"project":"lil-sandbox","sum":5}

json
Show a concise PHP runtime summary
php
PHP      8.x
SAPI     fpm-fcgi
OS       Linux
Binary   /usr/bin/php
Zend     4.x
Config   /etc/php.ini
Modules  42
Show PHP version, SAPI and binary
php version
PHP     8.x
SAPI    fpm-fcgi
OS      Linux
Binary  /usr/bin/php
Zend    4.x
Show loaded PHP extensions and optionally filter their names
php modules
Core       curl       fileinfo   json       openssl
date       dom        filter     mbstring   pcre
exif       gd         iconv      mysqli     session
Show loaded PHP extensions and optionally filter their names
php modules json
json
Show structured phpinfo data and optionally filter rows
php info memory
[PHP Core]
memory_limit       512M

[Environment]
MEMORY_PRESSURE    normal
Show structured phpinfo data and optionally filter rows
php info memory -c
[Core]
memory_limit       512M
memory_get_usage   enabled
Execute inline PHP code
php eval "echo PHP_VERSION;"
8.x
Handle a missing PHP file
php file \sandbox\missing.php
PHP file not found

File used in this example: sandbox/src/index.php

The example uses a file or directory from the protected /sandbox/ documentation workspace.

<?php

declare(strict_types=1);

require_once __DIR__.'/Calculator.php';

header('Content-Type: application/json; charset=utf-8');

echo json_encode([
    'project' => 'lil-sandbox',
    'sum' => Calculator::add(2, 3),
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)."\n";

Related documentation

Current public release

v1.2.22026-08-08

Cleaner PHP reference

Removes layout-specific wording and keeps phpinfo section flags concise.