If you are using Laravel Valet for local development on your Mac then you might need to change the php.ini
configuration to suit your needs. It can be either increasing memory_limit
, max_execution_time
etc.
If you want to configure/setup Laravel Valet on Mac M1 then you can follow my previous article here.
Recently, I wrote an article about how to configure PHP Monitor which provides you the visual information about Laravel Valet and different configurations. It can also let you local PHP configuration file php.ini
By default all the PHP versions will be located in /usr/local/etc/php
Let's say, your current active version of PHP is 7.3
and you want to change the max_execution_time
value. Go to the following location: /usr/local/etc/php/7.3
Here you will find php.ini
file which is the main configuration file. But there is another file php-memory-limits.ini
located inside the conf.d
folder. By default this fill will have the following configuration:
; Max memory per instance
memory_limit = 512M
;The maximum size of an uploaded file.
upload_max_filesize = 512M
; Sets max size of post data allowed.
; Changes to this will also need to be reflected in Nginx with client_max_body_size
; This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize
post_max_size = 512M
which overrides the main php.ini
file configurations.
For max_execution_time
you can add it to this file with your desired value and the whole file will look like this:
; Max memory per instance
memory_limit = 512M
;The maximum size of an uploaded file.
upload_max_filesize = 512M
; Sets max size of post data allowed.
; Changes to this will also need to be reflected in Nginx with client_max_body_size
; This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize
post_max_size = 512M
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 1800
Restart the PHP and verify your changes.
Top comments (2)
About the PHP configuration, there is a much easier way for PHP users -- ServBay.dev, especially for the beginners. It handles all PHP, MariaDB, PostgreSQL versions, plus Redis and Memcached. Run multiple PHP instances simultaneously and switch easily. No need any environment.
This tool has made my PHP dev simpler. Worth a shot!
I can work locally with the help of blog information!
Spell To make a friend come back
Some comments have been hidden by the post's author - find out more