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

PHP as a diagnostic tool

The bare php command tells you which PHP version, execution mode (SAPI), binary and extensions the hosting account actually uses. Check this before installing software that depends on an extension. php version is a shorter overview; php modules json checks whether a named extension is loaded.

Find the setting that matters

php info memory -c looks for memory-related entries in the configuration section. You can combine a search phrase with -g, -c, -m, -e, -v, -C, -l or -a. These are phpinfo sections, not system-shell flags. Environment and variables sections may contain sensitive values: avoid sharing their full output.

Running PHP deliberately

php eval "echo 2 + 3;" executes a short fragment. php file scripts/php-demo.php executes a file already on the hosting account. These forms are not a sandbox: the code runs with the PHP process permissions and can modify real files. Check the source before running it; the command rejects exit/halt constructs and limits captured output.

What the examples show

A compact summary, extension lookup, section filters and two explicit execution forms are demonstrated below. The shown results are fixed sandbox examples, not a live reading of your server.

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.

Show a concise PHP runtime summary

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.

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      json       openssl
date      dom       mbstring   session
Show loaded PHP extensions and optionally filter their names
php modules json
json
Phpinfo configuration section
php info memory -c
[Core]
memory_limit  512M
Phpinfo general section
php info php -g
[PHP]
PHP Version  8.x
Phpinfo modules section
php info json -m
[json]
JSON support  enabled
json version  1.x
Phpinfo environment section
php info path -e
[Environment]
PATH  /usr/local/bin:/usr/bin
Handle a missing PHP file
php info memory -v
No phpinfo matches
Phpinfo credits section
php info -C
[PHP Credits]
PHP Group  The PHP Group
Phpinfo license section
php info -l
[PHP License]
PHP License  version 3.01
All phpinfo sections
php info memory -a
[Core]
memory_limit  512M
Execute inline PHP code
php eval "echo 2 + 3;"
5
Execute one PHP file
php file \sandbox\scripts\php-demo.php
{"project":"lil-sandbox","sum":5}
Show loaded PHP extensions and optionally filter their names
php modules missing_extension
(none)
Execute one PHP file
php file \sandbox\missing.php
PHP file not found
Execute inline PHP code
php eval "exit;"
PHP exit is not allowed

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.