PHP.ini 生产与开发
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6880749/
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
Php.ini production vs development
提问by user780483
I'm using XAMPP to develop on my localhost. I would like to remove the PHP notices and keep only the warnings. I know this is done through the php.ini
file, however I'm having trouble locating it. I followed the path in phpinfo()
and it led me to /xampp/php
. Inside this folder are two php.ini
files: one for production and one for development. I have set them both to the error reporting level I'd like, however I still receive notices which makes me believe that neither of these actually control error reporting. I'm using the latest version of XAMPP. So I guess my question is where is the true php.ini
and what are these two other versions?
我正在使用 XAMPP 在我的本地主机上进行开发。我想删除 PHP 通知并只保留警告。我知道这是通过php.ini
文件完成的,但是我无法找到它。我跟着路径进去phpinfo()
,它把我带到了/xampp/php
。该文件夹中有两个php.ini
文件:一个用于生产,一个用于开发。我已经将它们都设置为我想要的错误报告级别,但是我仍然收到通知,这让我相信这两个实际上都没有控制错误报告。我正在使用最新版本的 XAMPP。所以我想我的问题是哪里是真的php.ini
,另外两个版本是什么?
采纳答案by Charles Sprayberry
First, make sure you're editing php.ini
, not php-development.ini
or php-production.ini
or anything BUT php.ini
. After that, ensure you restart your Apache server or your changes won't take effect.
首先,确保您正在编辑php.ini
, not php-development.ini
orphp-production.ini
或任何 BUT php.ini
。之后,请确保重新启动 Apache 服务器,否则您的更改将不会生效。
Also, check out ini_setfor setting ini values at runtime.
此外,请查看ini_set以在运行时设置 ini 值。
回答by Dalton
As of PHP 7 the regular php.ini file was removed and added with php.ini-production and php.ini-devlopment. In PHP's installation text file they state, "We advise you to use php.ini-production, because we optimized the default settings in this file for performance, and security."
从 PHP 7 开始,常规的 php.ini 文件被删除并添加了 php.ini-production 和 php.ini-devlopment。在 PHP 的安装文本文件中,它们声明:“我们建议您使用 php.ini-production,因为我们优化了该文件中的默认设置以提高性能和安全性。”
So in short use the php.ini-production
所以简而言之,使用 php.ini-production
回答by gray
I had this confusion, in my computer, the php.ini file didn't appear with the .ini extension name visible - it was just php , and in the type column, it has the value 'configuration settings'
我有这种困惑,在我的计算机中, php.ini 文件没有出现 .ini 扩展名可见 - 它只是 php ,并且在类型列中,它的值为“配置设置”
回答by Manish
php.ini.development
and php.ini.production
are entirely different from php.ini
.
the problem is that in the php folder the required php.ini
is not marked along with its extension ( .php
). Only php is written.Check the properties of the file 'php
' of "*configuration settings*
" type.it must be .ini
,This is the exact file which manages error reporting.
php.ini.development
并且php.ini.production
完全不同php.ini
。问题是在 php 文件夹中,所需的文件php.ini
没有与其扩展名 ( .php
)一起标记。只写php php
。检查“ *configuration settings*
”类型的文件' '的属性。它必须是.ini
,这是管理错误报告的确切文件。
回答by Jaminyah
In XAMPP version 1.8.1 php.ini file located at \xampp\php\php.ini modify line 922 upload_max_filesize = 2M Note: 2M means 2MB, so change to 10M for 10MB file upload. Also note that php.ini-development and php.ini-production are different files from php.ini.
在位于\xampp\php\php.ini 的XAMPP 1.8.1 版php.ini 文件中修改第922 行upload_max_filesize = 2M 注意:2M 表示2MB,所以10MB 文件上传更改为10M。另请注意,php.ini-development 和 php.ini-production 是与 php.ini 不同的文件。
回答by Sumit Nath
PHP 5.3.0 has significantly improved performance and parsing of INI files, and adds several new syntax features.
PHP 5.3.0 显着提高了 INI 文件的性能和解析,并添加了几个新的语法特性。
The standard php.ini files have been re-organized and renamed. php.ini-development contains settings recommended for use in development environments. php.ini-production contains settings recommended for use in production environments
标准的 php.ini 文件已经过重新组织和重命名。php.ini-development 包含推荐用于开发环境的设置。php.ini-production 包含推荐用于生产环境的设置
回答by Sumit Nath
The PHP.ini file is still there, only it doesn't include the extension .ini, the extension has been removed. You will notice two file name php, one is application file another is configuration setting when you open configuration setting in notepad you will notice that it has ini extension. so the php configuration file is ini file.
PHP.ini 文件仍然存在,只是它不包含扩展名 .ini,扩展名已被删除。您会注意到两个文件名 php,一个是应用程序文件,另一个是配置设置,当您在记事本中打开配置设置时,您会注意到它具有 ini 扩展名。所以php配置文件是ini文件。
回答by Jason
My issue is that I was editing the php.ini-production
and overlooked the standard php.ini
file.
我的问题是我正在编辑php.ini-production
并忽略了标准php.ini
文件。
I edited the php.ini
file by adding extension=php_odbc.dll
and it fixed the error.
我php.ini
通过添加编辑文件extension=php_odbc.dll
并修复了错误。