أهم النقاط
- upload_max_filesize caps one file; post_max_size caps the whole request.
- post_max_size must be larger than upload_max_filesize.
- cPanel's MultiPHP INI Editor is the safest way to change limits on shared hosting.
When an upload fails with “The uploaded file exceeds the upload_max_filesize directive” or a database import stops halfway, PHP’s limits are too low for the job.
The settings that matter
upload_max_filesize— the largest single file PHP accepts.post_max_size— the largest whole request. Keep it a little aboveupload_max_filesize.memory_limit— memory one script may use. Large imports often need more.max_execution_time— seconds a script may run before it’s stopped.
Option 1: cPanel MultiPHP INI Editor (recommended)
- In cPanel, open Software → MultiPHP INI Editor.
- On the Basic Mode tab, select your domain.
- Set, for example,
upload_max_filesizeto64M,post_max_sizeto72M,memory_limitto256M. - Click Apply. Changes take effect immediately.
Option 2: .user.ini
Create or edit .user.ini in the site’s document root:
upload_max_filesize = 64M
post_max_size = 72M
memory_limit = 256M
max_execution_time = 120
PHP rereads this file every few minutes (5 by default), so wait briefly before testing.
Option 3: php.ini on a VPS
Find the active file with php --ini (for the web server, check the PHP-FPM version’s php.ini), change the values, and restart PHP-FPM, for example sudo systemctl restart php8.3-fpm.
الأسئلة الشائعة
How do I check my current limits?
In WordPress, open Tools → Site Health → Info → Server. Anywhere else, create a temporary phpinfo() file, read the values, then delete the file.
Should I edit .htaccess or php.ini?
Use whatever your host supports. With PHP-FPM (most modern hosting), php_value lines in .htaccess cause a 500 error — use .user.ini or the cPanel editor instead.