How to locate the php.ini file (xampp)
I am using xampp
server for PHP
development and want to edit the php.ini
file; where can I locate it?
For Windows, you can find the file in the C:\xampp\php\php.ini
-Folder (Windows) or in the etc
-Folder (within the xampp-Folder).
Under Linux, most distributions put lampp under /opt/lampp
, so the file can be found under /opt/lampp/etc/php.ini
.
It can be edited using a normal Text-Editor.
Clarification:
-
Xampp
(X (for "some OS"), Apache, MySQL, Perl, PHP) -
Lampp
(Linux, Apache, MySQL, Perl, PHP)
in this context, they can be substituted for one another.
Write the following inside phpini_path.php
( or AnyNameAsYouLike.php
) and run it in the browser.
<?php phpinfo();?>
Among various other parameters you'll get Loaded Configuration File
parameter which value is the path of php.ini
on the server.
The location of php.ini
depends on server operating system:
Windows (With Xampp Installation):
/xampp/php/php.ini
macOS, OS X:
/private/etc/php.ini
Linux:
/etc/php.ini
/usr/bin/php5/bin/php.ini
/etc/php/php.ini
/etc/php5/apache2/php.ini
In MacOS : /Applications/XAMPP/xamppfiles/etc/php.ini
If you have multiple php-versions (xampp etc) running, I find the easiest is to use:
php --ini
from the command line. In windows: either after you click Shell
in xampp, or directly in the regular cmd
to find the "global" version of php. With global I mean the version referenced to by your environment variables.