How to locate the php.ini file (xampp) [duplicate]
Asked Answered
E

19

106

I am using xamppserver for PHP development and want to edit the php.ini file; where can I locate it?

Etymon answered 31/5, 2011 at 9:8 Comment(0)
T
123

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.

Tutelary answered 31/5, 2011 at 9:11 Comment(4)
Only with xampp on windows it is the \xampp\php folderTacet
/etc/ deosn't have a xampp folderNeckar
/opt/lampp/etc/php.iniNeckar
@JonathanLeaders yeah, that's under4 Linux. I meant the etc-folder within the xampp/lampp folder.Tutelary
G
42

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
Ganef answered 6/7, 2013 at 11:0 Comment(1)
Incorrect. On Mac, /private/etc/php.ini doesn't exist.Arnhem
P
38

In MacOS : /Applications/XAMPP/xamppfiles/etc/php.ini

Perionychium answered 16/6, 2018 at 13:6 Comment(0)
A
15

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.

Alloway answered 19/11, 2017 at 16:18 Comment(0)
S
10

Run Xampp server.

  1. Go to http://localhost which will open up xampp dashboard.

  2. Go to PHPInfo link in the top navigation bar.

--- or directly type following url in the browser after run the XAMPP http://localhost/dashboard/phpinfo.php

This will open up php info page. There you can find "Loaded Configuration File /opt/lampp/etc/php.ini" which is the php.ini location.

Sferics answered 27/4, 2018 at 15:31 Comment(0)
L
8

my OS is ubuntu, XAMPP installed in /opt/lampp, and I found php.ini in /opt/lampp/etc/php.ini

Lemnos answered 23/7, 2013 at 6:47 Comment(1)
Thanks I have also installed xampp and found the php.ini in the above path that you mentioned :)Watercool
L
6

Put a script somewhere in your document root

<?php
phpinfo();

Among others the output of the function will tell you which php.inis are parsed before the script got executed.

Lucais answered 31/5, 2011 at 9:10 Comment(0)
O
2

I've always found the easiest way is php -i and filtering down.

*nix (including MacOS):

php -i | grep "Loaded Configuration File"

Windows:

php -i | findstr /C:"Loaded Configuration File"

Of course this assumes your CLI environment is using the same PHP binaries as your actual web server.

You can always check that to be sure using which php in *nix and where php in Windows.

Olette answered 11/4, 2019 at 15:8 Comment(3)
so, what do I do if in OSX there's no php.ini ? php -i | grep "Loaded Configuration File"  ✔  at 06:32:21 PM Loaded Configuration File => (none)Crochet
@MonaJalal: Then you do not have an ini file. Solution (in my case): sudo cp /etc/php.ini.default /etc/php.iniXylograph
@MonaJalal sudo find / -type f -name "php.ini" should help you (this will search the whole drive which could be slow, a more localized search would be faster like find /etc -type f -name "php.ini" for instance)Olette
P
2

I’ve run into the need while running on PhpStorm on my Mac. Follow the orange text.

enter image description here

Prosecutor answered 19/6, 2019 at 14:20 Comment(0)
S
2

This is one of those "you were technically accurate, but you didn't answer my question" but it doesn't mean the above were wrong or misguided - they just didn't run into my issue.

So, I figure I'll give an answer.

As the others mentioned (spot on), I created a file:

<?php
phpinfo(); 
?>

So that worked great. However, it showed "(none)"

So where do you find (none)!?

In my case, on Windows, you just go to where php is installed; I had already had installed it in c:\php I believe it would be the same steps on other platforms.

Then, from a command line, powershell for ex, type: notepad c:\php\php.ini

Tell it yes, you do want to create it, then add whatever changes you needed in the first place. For me, for example:

extension_dir = "c:\php\ext"
extension=mysqli
upload_max_filesize = 25M
post_max_size = 13M
max_execution_time = 300

Then save. Fixed!

By the way - if you do "file new" and then "save as" Notepad will helpfully rename your file to php.ini.txt. Friends let friends NOT AVOID THE CLI.

Stria answered 18/8, 2020 at 17:19 Comment(1)
This feels like an entirely different question and answer posted as an answer to a nine year old question. If you remove it here, but separate it into a question and an answer you can post the question and self answer it and increase both the quality of the site and your chances of getting an upvote.Logos
M
2

php.ini Location is here in MAC BOOK XAMPP = PHP configuration file: /Applications/XAMPP/xamppfiles/etc/php.ini enter image description here

Madigan answered 29/1, 2023 at 10:5 Comment(0)
C
1

If you have been using different installers, you may well end up with more that one php.ini file on your hdd, which could affect your sanity after a while.

Search your hdd for 'php.ini' just in case there is more than one.

Another sanity-saving move is to remember to always restart your server (apache) after altering a value in php.ini.

Chemnitz answered 31/5, 2011 at 9:33 Comment(0)
H
1

i'm using xampp with PHP 7. you can trying looking for php.ini in

/etc/php/7.0/apache2

Hammering answered 26/5, 2017 at 10:41 Comment(0)
C
1

in my case it is present as "php.ini-development" and "php.ini-production" in php folder

Calculate answered 29/6, 2017 at 13:7 Comment(0)
I
1

Am running LAMP on Debian and mine is in:

/etc/php/7.0/apache2/php.ini
Indestructible answered 4/11, 2017 at 20:38 Comment(0)
F
1

step1 :open xampp control panel

step 2: then click apache module config button.

step 3. after that you able to see some config file list.

step 4: then click the php.ini file.it will be open into default editor.

image was given blow for refernce. enter image description here

Fullscale answered 27/4, 2020 at 12:23 Comment(0)
L
0

In the documentation http://www.apachefriends.org/en/xampp-windows.html (Configuration files section, near the bottom of the page): \xampp\php\php.ini

Laidlaw answered 31/5, 2011 at 9:13 Comment(0)
A
0

as KingCrunch pointed out, using phpinfo you can see what config file is in action in the "Loaded Configuration File" row. in my case in was in C:\xampp\apache\bin note that there is a php.ini also in C:\xampp\php which seems to be redundant and irrelevant

Assertive answered 10/11, 2013 at 21:41 Comment(0)
P
0

Step 1: Goto xammp

Step 2: Find php Foleder and click on it,

Find 2: Below php.ini file

Path : C:\xampp\php enter image description here

Second Example : step 1: Open xampp control panel

Step 2: Click On config,

Step 3: Find Here php.ini file

enter image description here

To get loaded php.ini files location try: command : php --ini

enter image description here

Peterkin answered 16/10, 2020 at 7:25 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.