Different php.ini path outputs



When I write this into bash:
php --ini

it gives me:
Configuration file (php.ini) Path: /usr/local/lib
Loaded Configuration file: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)

But then in browser phpinfo() gives me:

Configuration File (php.ini) Path /etc/php5/apache2
Loaded Configuration File /etc/php5/apache2/php.ini
Scan this dir for additional .ini files /etc/php5/apache2/conf.d
Additional .ini files parsed /etc/php5/apache2/conf.d/05-opcache.ini,

Why the outputs are so different?


Hmmm, did we not answer this in another recent post?

The PHP gives you the PHP folders. The Apache gives your the server’s folders.
A command in PHP is not the same as a live website that you go to in a browser. Two different results as they should be. One is from a server’s viewpoint with a local command entered, the other from a websites folder results. Are you having an issue with them?

Locally on a hard drive, you would have a folder you store items in. A website for example might be under your public_html or your WWW folder. When viewing that folder in some PHP code on a website that is stored inside of those folders, it does not normally show the folders outside of those. A website’s ROOT folder is the WWW/website-name usually. Does this help or confuse you? Ask further questions if you are still not clear on it.


Thanks for answer! This made it little bit clearer for me.