Php.ini production vs development
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.
Also, check out ini_set for setting ini values at runtime.
How is php.ini related to php.ini-development and php.ini-production?
They are template files for you to copy over to your actual php.ini
if you feel it matches your environment's needs.
- Development environment offers verbose messages and comfortable optional features, what you want when you're coding your scripts.
- Production environment is typically more minimalist (i.e. errors are logged rather than displayed, etc), for interacting with real users efficiently.
PHP Error Reporting Production vs Development
Quoting the php-production.ini that should have come bundled with your PHP:
; PHP comes packaged with two INI files. One that is recommended to be used
; in production environments and one that is recommended to be used in
; development environments.
; php.ini-production contains settings which hold security, performance and
; best practices at its core. But please be aware, these settings may break
; compatibility with older or less security conscience applications. We
; recommending using the production ini in production and testing environments.
and further
; display_errors
; Default Value: On
; Development Value: On
; Production Value: Off
; display_startup_errors
; Default Value: Off
; Development Value: On
; Production Value: Off
; error_reporting
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; html_errors
; Default Value: On
; Development Value: On
; Production value: On
; log_errors
; Default Value: Off
; Development Value: On
; Production Value: On
Since you asked for best practise, I suggest you go with that.
Using php.ini-production and php.ini-development - php.ini breaks Kubernetes env vars
Seems like switch from fetching environmental variables with $_ENV['<varname>']
to getenv('<varname>')
fixed the issue.
php.ini file nowhere to be found?
Where PHP is installed C:\php
there is a php.ini-development
and php.ini-production
. You can copy or rename one of these to php.ini
. These are templates and have all of the default settings that are needed. The main difference is that the development one will have error reporting turned on and the production one will not:
It should be loaded from either the PHP directory C:\php
or C:\windows
. I use the PHP directory as PHP I believe, will always look in the directory from which PHP is run:
copy c:\php\php.ini-development c:\php\php.ini
Or:
copy c:\php\php.ini-development c:\windows\php.ini
My system:
Configuration File (php.ini) Path C:\Windows
Loaded Configuration File C:\app\php\php.ini
Related Topics
Soapclient: How to Pass Multiple Elements with Same Name
Pass Base64 Jpeg Image to Og:Image
How to Remove Empty Values from Multidimensional Array in PHP
Printing PHP Script Output to File
Call to Undefined Function Oci_Connect, PHP_Oci8_12C.Dll, Windows 8.1, PHP5.6.6
PHP Dynamic Db Page Rewrite Url
Defining a Namespace for Laravel 8 Routes
Un-Encrypting/Re-Encrypting a Coldfusion Encrypted String in PHP
Xpath in Simplexml for Default Namespaces Without Needing Prefixes
How to Add Custom Fonts in Tcpdf
How Check Memory Location of Variable in PHP
In Simplexml, How to Add an Existing Simplexmlelement as a Child Element