0. php-v
$ php -v
PHP 5.5.22 (cli) (built: Apr 7 2015 10:29:09)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
with Xdebug v2.3.1, Copyright (c) 2002-2015, by Derick Rethans
1. php-i
You can get full phpinfo() using :
php -i
So, we can use grep
with php -i to get the config that you want.
Find the php.ini file
$ php -i | grep 'Configuration File'
Configuration File (php.ini) Path => /usr/local/etc/php/5.5
Loaded Configuration File => /usr/local/etc/php/5.5/php.ini
or
$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/5.5
Loaded Configuration File: /usr/local/etc/php/5.5/php.ini
Scan for additional .ini files in: /usr/local/etc/php/5.5/conf.d
Additional .ini files parsed: /usr/local/etc/php/5.5/conf.d/ext-mcrypt.ini
If you want to known the timezone which was set:
$ php -i | grep 'date.timezone'
date.timezone => Asia/Tokyo => Asia/Tokyo
2. php-a : interactive shell
To start a PHP interactive shell from the Linux terminal using following php -a (enabling PHP Interactive mode) command.For example:
~ chung$ php -a
Interactive shell
php > $a = array(1, 2 ,3);
php > print_r($a);
Array
(
[0] => 1
[1] => 2
[2] => 3
)
You can use interactive shell to quick test php built-in function behaviour.< ~ to be continue ~ >