Step 1: Find the php.ini your site uses
| How PHP runs | Typical php.ini on Ubuntu/Debian | Apply changes with |
|---|---|---|
| PHP-FPM (Nginx or Apache with FPM) | /etc/php/8.3/fpm/php.ini | sudo systemctl reload php8.3-fpm |
| Apache mod_php | /etc/php/8.3/apache2/php.ini | sudo systemctl restart apache2 |
| Command line (cron, Composer, WP-CLI) | /etc/php/8.3/cli/php.ini | Takes effect on the next command |
| AlmaLinux/Rocky (php-fpm) | /etc/php.ini | sudo systemctl reload php-fpm |
Running php --ini in a terminal shows the CLI file only, which is the most common source of confusion. To see what the web server uses, create a temporary file in your site's root:
<?php phpinfo();
Open it in a browser and look for Loaded Configuration File and Scan this dir for additional .ini files. Delete the file immediately afterwards: phpinfo output reveals details an attacker would find useful.

Step 2: Change the settings that fix common errors
| Setting | Default (typical) | Example value | Fixes |
|---|---|---|---|
upload_max_filesize | 2M | 64M | Uploads rejected as too large |
post_max_size | 8M | 64M | Large forms or uploads failing silently (keep it at least as big as upload_max_filesize) |
memory_limit | 128M | 256M | "Allowed memory size exhausted" |
max_execution_time | 30 | 120 | Long imports or reports timing out |
max_input_vars | 1000 | 3000 | Large menus or settings pages not saving |
date.timezone | (unset) | Asia/Kolkata | Wrong times in logs and orders |
display_errors | Off | Off in production | Errors exposed to visitors |
Open the file with sudo nano /etc/php/8.3/fpm/php.ini, search for each setting (Ctrl+W in nano), and edit the existing line instead of adding a duplicate at the end. Lines starting with ; are comments. The full list of directives is in the PHP manual's php.ini directive list.
Uploads also need a web server change
Nginx has its own upload limit. If uploads still fail after raising PHP's limits, add client_max_body_size 64M; to the server block and run sudo nginx -t && sudo systemctl reload nginx.
Step 3: Apply and verify
sudo php-fpm8.3 -t
sudo systemctl reload php8.3-fpm
The first command tests the configuration; a reload applies it without dropping requests in progress. Then reload your phpinfo page (create it again briefly) or check one value from the FPM side with a small script that echoes ini_get('upload_max_filesize').
Per-site settings instead of global changes
Raising limits for every site on a server is rarely necessary. Better options:
- PHP-FPM pool overrides. Each site's pool file (for example
/etc/php/8.3/fpm/pool.d/shop.conf) can set its own values:php_admin_value[upload_max_filesize] = 128M php_admin_value[post_max_size] = 128M php_admin_value[memory_limit] = 512Mphp_admin_valuecannot be overridden by the application;php_valuecan. .user.inifiles. PHP-FPM reads a.user.iniin the site's directory for settings that are allowed per directory. Changes are picked up after a few minutes (theuser_ini.cache_ttlsetting).- Control panels. cPanel's MultiPHP INI Editor and Plesk's PHP settings write these overrides for you.
Do not raise memory_limit blindly
memory_limit is a per-request ceiling, not a pool. If PHP-FPM can run 30 workers and each may use 512 MB, the worst case is 15 GB. Raise it only for the sites that need it, and size pm.max_children to fit your RAM, as explained in our Ubuntu VPS optimisation guide. If you see processes killed by the kernel after raising limits, the troubleshooting guide shows how to confirm it.
php.ini settings for large imports
Importing a big WordPress export, a product CSV or a database backup through a web interface often hits several limits at once: upload size, post size, execution time and memory. Raise them temporarily in the site's pool file, complete the import, then set them back. For database imports, the command line is usually the better route because it avoids PHP limits entirely; see how to export and import a MySQL database.
Common php.ini mistakes
- Editing the CLI file and wondering why the website did not change.
- Raising
upload_max_filesizebut notpost_max_sizeor Nginx'sclient_max_body_size. - Forgetting to reload PHP-FPM after editing.
- Leaving
display_errors = Onin production. - Leaving a phpinfo file on the server.
- Upgrading PHP (for example from 8.2 to 8.3) and forgetting that the new version has its own php.ini.
Why developers choose SkyRain Cloud VPS
PHP sites run best with room to tune. SkyRain Cloud Intel VPS plans include:
- KVM virtualization. Your own kernel and allocated vCores, so you can tune the system the way this guide describes.
- Intel Xeon Platinum 8269CY hosts. Server-class Cascade Lake CPUs with DDR4 ECC memory.
- NVMe SSD storage on every plan, which keeps I/O wait low for databases and builds.
- Full root access to install and configure whatever your stack needs.
- Unmetered 1 Gbps port in India, close to your users.
- Simple billing and real support. Monthly billing in rupees with UPI, plus 24/7 tickets, WhatsApp and Discord.
Frequently Asked Questions
Where is php.ini on Ubuntu?
Why didn't my php.ini change take effect?
How do I increase the upload size limit in PHP?
Do I need to restart the server after editing php.ini?
Can I set different PHP limits for different sites?
What timezone should I set for an Indian website?
Conclusion
Editing php.ini is simple once you edit the right file: FPM for most Nginx sites, the Apache file for mod_php, and CLI for scripts. Change the setting that matches the error, keep post_max_size and the web server's limit in step with uploads, reload PHP-FPM, and prefer per-pool overrides for sites with special needs. Keep memory limits in proportion to your RAM and workers.
For a VPS with full control over PHP, see our Intel VPS plans.
SkyRain Cloud Intel Xeon VPS Plans
KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — Intel | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Business websites, small apps, scheduled jobs and bots | Order |
| VPS 2 — Intel | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,169/month | Business software, mid-size databases, several sites on one server | Check stock |
| VPS 3 — Intel | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,249/month | ERP/CRM stacks, heavier databases, multiple production apps | Check stock |
| VPS 4 — Intel | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,299/month | High-memory workloads and consolidated production servers | Check stock |
Prices are monthly in INR as listed on the SkyRain Cloud store (verified 2026-11-23). Live stock and final price are shown at checkout.