Php --ini vs phpinfo() (which one is more valid?)

When I run php --ini at my terminal screen I get :
Loaded Configuration File : /usr/local/lib/php.ini

On the other hand when I load in on my browser a php file containing only the phpinfo() function I get the following :
Loaded Configuration File : /etc/php.ini

Which one of the two php.ini files is being used by php?
Thank you.

Most likely explanation when you access php from terminal you are actually using a different php - not the same as your web browser is using.
This is actually pretty common to have 2 independent installations of php - one as apache module and one as a stand-along cgi version.

The answer is - when you access your php from web browser the /etc/php.ini is used (in your case)

Thanks for answering.Check my other question here ( about my failed effort to enable display_errors in /etc/php.ini
This question has not find an answer for a long time.

Strange that. You’re certain the changes to /etc/php.ini saved?

Are there any other scripts running before you get to your page? It could be that errors are being turned off in one of those scripts. Also, have you checked the php.ini file to make sure display_errors only appears once?

Doesn’t make sense on the surface - if you change the correct php.ini file to display_errors = on and restart apache, error reporting should be turned on. Can you paste your script?

aaarrrggh : You were right!I’ve found another line that set display_errors to off , after my setting.
If you are a member of stackoverflow, answer my question to get the credits!

Haha, I’m not a member of stackoverflow. Maybe I’ll sign up and have a go eh? :slight_smile:

There you go. I signed up - username: citypaul :slight_smile:

I just accepted your answer there.Thank you so much for your help!

Glad to be able to help :slight_smile: