How do I locate php.ini?

2

1

I installed php on the server and php_info(); displays:

Configuration File (php.ini) Path   /home/gmcnulty/php  

However, I don't see anything there nor do I see any php directory?

How do I locate the php directory and specifically the php.ini file?

Thanks.

Greg McNulty

Posted 2012-06-17T21:24:43.013

Reputation: 133

Answers

5

Try going into /etc and executing find -name "php.ini" This should tell you where php.ini is located.

superuser

Posted 2012-06-17T21:24:43.013

Reputation: 3 297

listed 6 directories followed by "Permission denied" - guess that mean I can't make changes to it? – Greg McNulty – 2012-06-17T21:43:26.273

Hm, were you able to find the file you're looking for? The Permission denied message is there probably because you aren't running the command in superuser mode. Try sudo find -name "php.ini" and that should go away. – superuser – 2012-06-18T03:27:46.177

2

If you can access the CLI, typing php --ini will show you which .ini file PHP is trying to load.

It's possible, but unlikely, that you have no php.ini file at all, and could create one in the place that php_info(); suggests.

If you are on shared hosting, you may not be able to navigate highter than /home/gmcnulty, so in this case you should look for the php directory in the highest level you can access.

It is normal for php.ini to live in /etc, but I have also seen it installed in /var/lib before.

Ben XO

Posted 2012-06-17T21:24:43.013

Reputation: 239