Skip to content
Readerstacks logo Readerstacks
  • Home
  • Softwares
  • Angular
  • Php
  • Laravel
  • Flutter
Readerstacks logo
Readerstacks

How to increase maximum file upload size in php ?

Aman Jain, August 24, 2021August 24, 2021

Php is the most used language in web. sometimes it required to upload the files which is greater then 2 mb.

In php default upload size is 2 mb and if we wanted to increase it then we have multiple ways to change the size of uploading.

1. Change from php.ini file

php.ini is main configuration file in php where all settings of php are defined. This type of configuration mainly used on localhost or dedicated server where we can access file system using ssh terminal.

Steps to change the upload size

  1. Locate/Find the php.ini file

    Sometimes we install multiple version of php in our system and it will get hard to find the correct file for php.ini. so to find the php.ini we can follow this guideline. Easiest way to find php.ini ?
  2. Edit the file using below command

    Sudo vi path_of_php.ini

    Example:

    php configuration file using phpinfo() in info.php
This image has an empty alt attribute; its file name is Screenshot-2021-08-24-at-8.35.49-AM-1024x586.png


sudo vi /Applications/XAMPP/xamppfiles/etc/php.ini

then search for variable upload_max_size and post_max_size

Screenshot 2021 08 24 at 9.03.23 AM
upload_max_size in php.ini
Screenshot 2021 08 24 at 9.04.03 AM
post_max_size in php.ini

and then restart the apache server

sudo service apache2 restart

2. Create php.ini file in root of project

if you are on shared server then you can create own php.ini file on root of project and add below code

post_max_size=40m
upload_max_size=40m

then save the file

3. Create .htaccess file and set php ini variables

Same as php.ini on root of project we can also add php configuration in htaccess file

php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 200
php_value max_input_time 200

then save .htaccess file in root of your project

4. Update from cpanel of website

To edit the configuration from cpanel you can follow this guideline. Easiest way to find php.ini ?

Related

Php

Post navigation

Previous post
Next post

Related Posts

Php Laravel CRUD with Search, Image and Pagination

Laravel CRUD with Search, Image and Pagination

July 1, 2022November 6, 2023

In this article i will learn laravel CRUD with Search, Image and Pagination in laravel. In this post we will not only cover the CRUD operation but also the validation on form, unique validation, image uploading and view the uploaded image, Flash messages, Search the uploaded data and many more….

Read More
Php Laravel orderBy clause in eloquent with example

Laravel orderBy clause in eloquent with example

October 5, 2022March 16, 2024

In this blog post, we will take a look at how to use the Laravel orderBy clause in the Eloquent ORM.Laravel provides an expressive, fluent interface for creating and retrieving records in your database. When we work with databases in Laravel, we often need to order the results we get…

Read More

Laravel 10 – Error During installation laravel/framework[v10.0.0] require composer-runtime-api ^2.2 – Solved

March 8, 2023March 16, 2024

Today i was installing laravel 10 with php version 8.2 and i encountered an issue laravel/framework[v10.0.0, …, v10.3.2] require composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint. This issue occurred due to old composer. So we can quickly fix this by running below command May be…

Read More

Aman Jain
Aman Jain

With years of hands-on experience in the realm of web and mobile development, they have honed their skills in various technologies, including Laravel, PHP CodeIgniter, mobile app development, web app development, Flutter, React, JavaScript, Angular, Devops and so much more. Their proficiency extends to building robust REST APIs, AWS Code scaling, and optimization, ensuring that your applications run seamlessly on the cloud.

Categories

  • Angular
  • CSS
  • Dart
  • Devops
  • Flutter
  • HTML
  • Javascript
  • jQuery
  • Laravel
  • Laravel 10
  • Laravel 11
  • Laravel 9
  • Mysql
  • Php
  • Softwares
  • Ubuntu
  • Uncategorized

Archives

  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • October 2024
  • July 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • July 2023
  • March 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Recent Posts

  • Mapping Together: The Vibrant Spirit of OpenStreetMap Japan
  • Understanding High Vulnerabilities: A Deep Dive into the Weekly Summary
  • Building a Million-Dollar Brand: The Journey of Justin Jackson
  • Mastering Schedule Management with Laravel Zap
  • The Resilience of Nature: How Forests Recover After Fires
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version