DEV Community

Cover image for How to Change PHP.ini Configuration on Mac for Laravel Valet
Ibrar Hussain
Ibrar Hussain

Posted on

7 2

How to Change PHP.ini Configuration on Mac for Laravel Valet

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

Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Restart the PHP and verify your changes.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (2)

Collapse
 
leslieeeee profile image
Leslie •

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!

Collapse
 
amandamorri profile image
AmandaMorri •
Comment hidden by post author

Some comments have been hidden by the post's author - find out more

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →