Thursday, April 14, 2016

Where is php.ini file located?

One of the most important file in php world is probably the php.ini file, this file contains configuration of the php that's running on your server. The question is where exactly this php.ini file located?

If you are on linux, most of the time the php.ini is located at /etc/php5/apache2/php.ini, you can navigate there from command line and open the file with your favorite text editor.


You can edit with this command:
sudo gedit /etc/php5/apache2/php.ini 
sudo leafpad /etc/php5/apache2/php.ini 
sudo vi /etc/php5/apache2/php.ini 
sudo nano /etc/php5/apache2/php.ini 

But if you are using xampp on linux or windows, the location of php.ini is little bit different.

Xampp on windows:

Xampp on linux:

For mac users, most likely the location of php.ini is on /private/etc/php.ini

On mac

If you still can't find your php.ini, the best way is to use the phpinfo() function, if you run this function it will generate special page, in there look for 'Loaded Configuration File', it will display the location of the php.ini file on your computer.

No comments:

Post a Comment