2025-03-14 21:59:59 -06:00
|
|
|
# php
|
|
|
|
|
|
|
|
|
|
> PHP command-line interface.
|
2025-12-16 10:20:31 -07:00
|
|
|
> More information: <https://www.php.net/manual/en/features.commandline.options.php>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Parse and execute a PHP script:
|
|
|
|
|
|
|
|
|
|
`php {{path/to/file}}`
|
|
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
- Check syntax on (i.e. [l]int) a PHP script:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
`php {{[-l|--syntax-check]}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
- Run PHP inter[a]ctively:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
`php {{[-a|--interactive]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Run PHP code (Notes: Don't use `<? ?>` tags; escape double quotes with backslash):
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
`php {{[-r|--run]}} "{{code}}"`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Start a PHP built-in web server in the current directory:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-09-14 18:48:49 -06:00
|
|
|
`php {{[-S|--server]}} {{host}}:{{port}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- List installed PHP extensions:
|
|
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
`php {{[-m|--modules]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Display information about the current PHP configuration:
|
|
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
`php {{[-i|--info]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Display information about a specific function:
|
|
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
`php {{[--rf|--rfunction]}} {{function_name}}`
|