如何定位 php.ini 文件 (xampp)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6185319/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to locate the php.ini file (xampp)
提问by Navane
I am using xampp
server for PHP
development and want to edit the php.ini
file; where can I locate it?
我正在使用xampp
服务器进行PHP
开发并想编辑php.ini
文件;我在哪里可以找到它?
回答by Lukas Knuth
For Windows, you can find the file in the C:\xampp\php\php.ini
-Folder (Windows) or in the etc
-Folder (withinthe xampp-Folder).
对于Windows,您可以在C:\xampp\php\php.ini
-Folder (Windows) 或etc
-Folder (在xampp-Folder内)中找到该文件。
Under Linux, most distributions put lampp under /opt/lampp
, so the file can be found under /opt/lampp/etc/php.ini
.
在Linux 下,大多数发行版都将 lampp 放在下面/opt/lampp
,因此可以在/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)
Xampp
(X(对于“一些OS”),阿帕什,中号ySQL,PERL,PHP)Lampp
(大号inux下,甲帕什,中号ySQL,PERL,PHP)
in this context, they can be substituted for one another.
在这种情况下,它们可以相互替代。
回答by Ipsita Rout
Write the following inside phpini_path.php
( or AnyNameAsYouLike.php
) and run it in the browser.
在phpini_path.php
( 或AnyNameAsYouLike.php
) 中写入以下内容并在浏览器中运行它。
<?php phpinfo();?>
Among various other parameters you'll get Loaded Configuration File
parameter which value is the path of php.ini
on the server.
在其他各种参数中,您将获得Loaded Configuration File
参数,其值是php.ini
服务器上的路径。
The location of php.ini
depends on server operating system:
的位置php.ini
取决于服务器操作系统:
Windows (With Xampp Installation):
Windows(安装 Xampp):
/xampp/php/php.ini
macOS, OS X:
macOS、OS X:
/private/etc/php.ini
Linux:
Linux:
/etc/php.ini
/usr/bin/php5/bin/php.ini
/etc/php/php.ini
/etc/php5/apache2/php.ini
回答by PЯINC?
In MacOS : /Applications/XAMPP/xamppfiles/etc/php.ini
在 MacOS 中: /Applications/XAMPP/xamppfiles/etc/php.ini
回答by ippi
If you have multiple php-versions (xampp etc) running, I find the easiest is to use:
如果您有多个 php 版本(xampp 等)在运行,我发现最简单的方法是使用:
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.
从命令行。在 windows 中:要么在您单击Shell
xampp 后,要么直接在常规cmd
中找到 php 的“全局”版本。全局是指您的环境变量引用的版本。
回答by Madura Pradeep
Run Xampp server.
运行 Xampp 服务器。
Go to http://localhostwhich will open up xampp dashboard.
Go to PHPInfo link in the top navigation bar.
转到http://localhost这将打开 xampp 仪表板。
转到顶部导航栏中的 PHPInfo 链接。
--- or directly type following url in the browser after run the XAMPP http://localhost/dashboard/phpinfo.php
--- 或者在运行XAMPP http://localhost/dashboard/phpinfo.php后直接在浏览器中输入以下url
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.
这将打开 php 信息页面。在那里您可以找到“已加载的配置文件 /opt/lampp/etc/php.ini”,这是 php.ini 的位置。
回答by KingCrunch
Put a script somewhere in your document root
将脚本放在文档根目录中的某个位置
<?php
phpinfo();
Among others the output of the function will tell you which php.ini
s are parsed before the script got executed.
其中,函数的输出将告诉您php.ini
在脚本执行之前解析了哪些s。
回答by kai
my OS is ubuntu, XAMPP installed in /opt/lampp
, and I found php.ini in /opt/lampp/etc/php.ini
我的操作系统是 ubuntu,XAMPP 安装在/opt/lampp
./opt/lampp/etc/php.ini
回答by Bruce Tong
i'm using xampp with PHP 7. you can trying looking for php.ini in
我在 PHP 7 中使用 xampp。您可以尝试在其中查找 php.ini
/etc/php/7.0/apache2
/etc/php/7.0/apache2
回答by farhan bashir
in my case it is present as "php.ini-development" and "php.ini-production" in php folder
在我的情况下,它在 php 文件夹中显示为“php.ini-development”和“php.ini-production”
回答by steven7mwesigwa
Am running LAMP
on Debianand mine is in:
我LAMP
在Debian 上运行,我的在:
/etc/php/7.0/apache2/php.ini