Prerequisites
Before changing PHP upload size, make sure you have:
- SSH access to your VPS
- Root or sudo privileges
PHP Settings to Change
Three main settings control upload limits:
- upload_max_filesize - Maximum file upload size (default: 2M)
- post_max_size - Maximum POST data size (must be larger than upload_max_filesize)
- memory_limit - Maximum memory a script can use
Method 1: Edit php.ini
For PHP 8.2 FPM:
nano /etc/php/8.2/fpm/php.ini
Change values (example for 100MB uploads):
upload_max_filesize = 100M
post_max_size = 110M
memory_limit = 128M
Also update CLI version:
nano /etc/php/8.2/cli/php.ini
Method 2: Change for Specific Domain via .htaccess
For Apache in HestiaCP, create .htaccess:
nano /home/admin/web/example.com/public_html/.htaccess
Add:
php_value upload_max_filesize 100M
php_value post_max_size 110M
php_value memory_limit 128M
Method 3: Change via User ini File
Create user.ini in domain root:
nano /home/admin/web/example.com/public_html/.user.ini
Add:
upload_max_filesize = 100M
post_max_size = 110M
memory_limit = 128M
Restart PHP-FPM:
systemctl restart php8.2-fpm
Method 4: Using HestiaCP Web Template
Edit backend template:
nano /usr/local/hestia/data/templates/web/php-fpm/php82-custom.tpl
Add:
PHP_ADMIN_VALUE[upload_max_filesize] = 100M
PHP_ADMIN_VALUE[post_max_size] = 110M
PHP_ADMIN_VALUE[memory_limit] = 128M
Also Update Nginx Settings (If Using Nginx)
For large file uploads, also update Nginx:
nano /etc/nginx/nginx.conf
In http block:
client_max_body_size 100M;
Restart Nginx:
systemctl restart nginx
Verify Changes
Create PHP info file:
echo "" > /home/admin/web/example.com/public_html/info.php
Browse to https://example.com/info.php and search for upload_max_filesize.
Recommended Upload Limits by Use Case
| Use Case | upload_max_filesize | post_max_size |
|---|---|---|
| Basic website | 2M-10M | 10M-12M |
| WordPress with images | 32M | 64M |
| Video uploads | 100M-500M | 110M-550M |
| Large file sharing | 1G-2G | 2G |
✅ PHP upload size has been increased!