Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get an ini setting in PHP at the command line

Tags:

linux

php

On the Linux command line, is it possible to run a command to get a PHP ini settings value?

I understand that I can echo phpinfo() or simply go and inspect the .ini file, but I can’t see a command to run that will display the value directly on the command line.

like image 254
Marty Wallace Avatar asked Jan 17 '13 23:01

Marty Wallace


People also ask

How do I find my PHP ini version?

To get the php. ini file which is being used by Apache you will probably have to add phpinfo() into a . php file and open it in the browser. As php -r "phpinfo();" | grep php.

Where is PHP ini located Linux?

The default location for the php. ini file is: Ubuntu 16.04: /etc/php/7.0/apache2. CentOS 7: /etc/php.


1 Answers

php -i | grep 'my_value'

or

php -r "echo ini_get('my_value');"

or

grep 'my_value' /path/to/php.ini
like image 170
Sammitch Avatar answered Oct 11 '22 06:10

Sammitch