PHP Configuration File Changes

Created At: 2023-05-04 18:12:39 Updated At: 2024-06-03 10:46:48

I wanted to upload longer videos from my Laravel backend, but looks like I could not. I got issues like below. The below configuration works with PHP 7.2, 8.0, 8.2 and onwards.

At first it looks like Laravel issue but it's actually issue in the php.ini file. We need to change it. 

Find the file

On the terminal run this

php --ini

and you will see the location.

php ini location mac

So it would give you the path of php ini on your machine. It's the second line where file locates. 

Open the file

Now you need to open the file, you may use vim editor to do it. Do

vim /usr/local/etc/php/8.2/php.ini

Make sure you have the correct path. Then you need to look for two lines

post_max_size = 1024M                                                                                                            

upload_max_filesize = 1024M 

Do look for them you may a special command and hit enter

/^post

You should be able to find post_max_size. If you can not find yet click keyboard letter n and it would go to the next match.

Once you find it, hit i in the keyboard to edit and change as you need.

You should look for the next change using the same command.

Once you make the changes do

esc button press and then :wq

It would save the changes.

Install FPM

After that you need to restart your php service. To restart make sure you have PHP-FPM. If not make sure you run

brew tap homebrew/services

It will install the necessary services.

And then run the below command to make changes effective

brew services restart php@8.2

After that you will find 

If it still does not work, make sure you restart your computer. 

Comment

Add Reviews

Recommended Posts

Latest Posts

Subscribe our newsletter