Where is php.ini located?

by Yang Yang on June 1, 2009

Well it depends on the Linux distribution you are using, the version of php and the way you install it with Apache web server. Php.ini may be here:


Or here:


Or here:


Anyway, you can always find any file named php.ini in this manner

find / -name php.ini

The simplest yet most powerful usage of the renowned find command. By its help I was able to locate the php.ini on my Ubuntu 9.04 Apache2 and PHP5:


Use phpinfo() to find out

Write a simple PHP file with the following content:

<?php phpinfo();

And upload it to your server and access it in your web browser to get a page like this:

PHP configuration file php.ini path

PHP configuration file php.ini path

dfwolf March 23, 2010 at 9:30 pm

I installed Nginx, and found the file with the commend “find / -name php.ini”

John Ortiz July 31, 2010 at 4:52 am

Thanks for this information. Now I’m modifying php.ini on my local server. Thanks again. Regards.

dhanesh mane October 8, 2010 at 3:55 pm

@John Ortiz I suggest you to restart the server after editing the ini file.

david October 24, 2010 at 6:01 am

almost an hour i’m looking for that php.ini file. I know the path of that file, but where should i go?? i got hosting, not server, maybe this is not right?

nasiib November 28, 2010 at 4:19 am

i wanna ask them question . it.s no easily so why? tel information about that .remember i have to it

ssultan April 14, 2011 at 9:28 am

Will I need to send an email to my hosting service provided to see how the php.ini file is configured please?

saidesh July 25, 2012 at 2:01 am

Can I add php.ini file in my website home directory.

Retrify October 29, 2012 at 9:01 pm

thank you yang yang

Luthfie April 26, 2013 at 3:20 am

Many thanks, ^_^
i used to try to find it manually, but fail, hehe

Sathish May 9, 2013 at 7:34 pm

Thanks for this information. I’m using Share webhosting, i dont have access for PHP.ini file. may i know how can i replace this ?

Comments on this entry are closed.

{ 3 trackbacks }

Previous post:

Next post: