Where is php.ini located?

by Yang Yang on June 1, 2009

in Linux Server Administration Tips, PHP Tips & Tutorials

Share This Article:
Subscribe to Kavoir: blog feed

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:

/etc/php.ini

Or here:

/etc/php/php.ini
/etc/php5/php.ini

Or here:

/usr/bin/php5/bin/php.ini

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:

/etc/php5/apache2/php.ini

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

Share This Article:
Subscribe to Kavoir: blog feed

You should also read:

{ 7 comments… read them below or add one }

dfwolf March 23, 2010 at 9:30 pm

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

Reply

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.

Reply

dhanesh mane October 8, 2010 at 3:55 pm

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

Reply

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?

Reply

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

Reply

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?

Reply

keo thida January 25, 2012 at 4:37 pm

Hello everybody,
I would like to all of you one question, after I installed Cacti already, I restart all services like mysql, crontab, snmp, apache2 it Okay. But when I access (http://IP-server/cacti) it alert the message that:
Error
The following PHP extension is missing
.sockets
Please install those extension and retry. Thanks in advance.

Reply

Leave a Comment

{ 2 trackbacks }

Previous post:

Next post: