PHP命令行常用参数说明和使用

-i 打印phpinfo命令

root@DK:/mnt/hgfs/cpp/php# php -i | grep session

-v 输出php版本信息

root@DK:/mnt/hgfs/cpp/php# php -v
PHP 7.0.0 (cli) (built: Apr 12 2018 15:26:33) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

-m 输出已经安装的扩展模块

$ php -m
[PHP Modules]
xml
tokenizer
standard
session
posix
pcre
overload
mysql
mbstring
ctype
 
[Zend Modules]

-r 允许运行命令行php代码

root@DK:/mnt/hgfs/cpp/php# php -r 'var_dump($GLOBALS);'

-w 去掉注释输出源码 显示除去了注释和空格的源代码。 该选项不能和 -r 参数同时使用。

root@DK:/mnt/hgfs/cpp/php# php -w test.php
<?php
 echo "参数{$argc}"; print_r($argv); ?>

其他命令暂时还没用到!

原文地址:https://www.cnblogs.com/wanglijun/p/8822026.html