Here there is a good configuration for your PHP environment. It is a good checklist to use, for example, when you update MAMP.
php.ini, located at
Keep attention to the version of PHP you are using with MAMP!
Then, find those lines and edit them:
- Higher the
memory_limit. I’ve set it to
1073741824, that is 1GB 🙂 (using the amount in bytes instead of in MB):
memory_limit = 1073741824 ; Maximum amount of memory a script may consume (1GB)
- Set the error reporting to E-ALL:
; error_reporting is a bit-field. Or each number up to get desired error ; reporting level ; E_ALL - All errors and warnings ; E_ERROR - fatal run-time errors ; E_WARNING - run-time warnings (non-fatal errors) ; E_PARSE - compile-time parse errors ; E_NOTICE - run-time notices (these are warnings which often result ; from a bug in your code, but it's possible that it was ; intentional (e.g., using an uninitialized variable and ; relying on the fact it's automatically initialized to an ; empty string) ; E_CORE_ERROR - fatal errors that occur during PHP's initial startup ; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's ; initial startup ; E_COMPILE_ERROR - fatal compile-time errors ; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) ; E_USER_ERROR - user-generated error message ; E_USER_WARNING - user-generated warning message ; E_USER_NOTICE - user-generated notice message ; ; Examples: ; ; - Show all errors, except for notices ; ;error_reporting = E_ALL & ~E_NOTICE ; ; - Show only errors ; ;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR ; ; - Show all errors except for notices ; error_reporting = E_ALL
- Display errors, so you can see all the errors produced by your app:
; Print out errors (as a part of the output). For production web sites, ; you're strongly encouraged to turn this feature off, and use error logging ; instead (see below). Keeping display_errors enabled on a production web site ; may reveal security information to end users, such as file paths on your Web ; server, your database schema or other information. display_errors = On
- Display startup errors, that is useful, for example, to intercept errors caused by new PHP extensions installed, as Intl, for example:
; Even when display_errors is on, errors that occur during PHP's startup ; sequence are not displayed. It's strongly recommended to keep ; display_startup_errors off, except for when debugging. display_startup_errors = On
- Set the
error_logdirectory: it may happen that a blank page appears and this is the only way to know what happened.
; Log errors to specified file. PHP's default behavior is to leave this value ; empty. ; http://php.net/error-log ; Example: error_log = php_errors.log ; Log errors to syslog (Event Log on Windows). ;error_log = syslog
- Set the default timezone:
[Date] ; Defines the default timezone used by the date functions ; Will be changed by MAMP to system timezone date.timezone = "Europe/Rome"
Those are the base modifications you have to do to have a good development environment.
Maybe you want also activate some extensions and this requires edit the php.ini file too:
Setting all the errors to be shown is the worst practice in production as those errors may provide an attacker a lot of useful information about your system: on production, ever turn off all the errors! Ever!
Remember to “Make. Ideas. Happen.”.
I wish you flocking users, see you soon!