2025-03-14 21:59:59 -06:00
|
|
|
# php
|
|
|
|
|
|
|
|
|
|
> PHP command-line interface.
|
|
|
|
|
> More information: <https://php.net>.
|
|
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
- Run PHP code (Notes: Don't use <? ?> tags; escape double quotes with backslash):
|
|
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
`php {{[-r|--run]}} "{{code}}"`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-07-24 22:27:13 -06:00
|
|
|
- Start a PHP built-in web [S]erver in the current directory:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-07-24 22:27:13 -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}}`
|