In VestaCP, the correct php.ini is the one loaded by the PHP runtime serving your domain, not necessarily the file used by the command-line client. First map the domain to its PHP version, then confirm the active configuration through that same web SAPI. On a typical PHP-FPM installation the file is /etc/php/X.X/fpm/php.ini; other Vesta forks may use a different path. Edit only the required directive, restart or reload the matching PHP-FPM service, verify the value from the website, and remove any diagnostic page afterward.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
1. Identify the PHP runtime serving the domain
VestaCP installations can run several PHP versions at once. A domain might use PHP 7.4 while the server also has PHP 8.2, and each version can have separate configuration files. The command-line php binary can point to yet another version. Editing the wrong file produces the most common “my php.ini change did not work” result.
As an Amazon Associate I earn from qualifying purchases.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsCheck the domain mapping
On Vesta-compatible systems that provide the helper, run:
sudo /usr/local/vesta/bin/v-get-php-version-of-domain yourdomain.com
Replace yourdomain.com with the exact hosted domain. Record the returned version and confirm that the domain is actually using PHP-FPM, CGI/FastCGI, or an Apache PHP module. Vesta forks and operating-system packages expose these choices differently, so treat the command as a mapping check rather than proof of a universal layout.
#1 Best Overall
Do not infer the web version from CLI PHP
php -v and php --ini describe the PHP binary invoked in your shell. They do not guarantee what Apache, CGI, or PHP-FPM uses for a browser request. Use CLI output as a clue, then verify the web runtime with a temporary, restricted diagnostic page as described later.
2. Find the active php.ini file
The path depends on the distribution, installed PHP version, SAPI, and Vesta fork. A common PHP-FPM layout documented by myVesta is:
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →/etc/php/X.X/fpm/php.ini
Here, X.X is the active PHP version, such as 8.2. Other installations may use /etc/php.ini, /opt/phpX.X/etc/php.ini, or another SAPI-specific location. Never overwrite a path merely because it is familiar.
Confirm from the relevant binary
For a command-line binary, run:
php --ini
The output identifies the loaded configuration file and any scanned additional-configuration directory for that binary. If several PHP binaries are installed, invoke the one matching the domain version instead of relying on the unqualified php command.
Confirm from the web request
A web diagnostic is the authoritative check for a website. Create a temporary file in the domain’s document root containing:
<?php
phpinfo();
?>
Protect it with an access restriction, a non-obvious temporary filename, or both. Open it through the affected domain and locate Loaded Configuration File, the PHP version, and the SAPI row. This tells you exactly which file the browser request read. Delete the file immediately after collecting the information; a public phpinfo() page discloses paths, modules, environment variables, and configuration details.
Rank #2
3. Back up the file and edit one directive
Use root access for a system-level file and preserve a reversible copy before changing it. For example, after substituting the confirmed path:
sudo cp /etc/php/X.X/fpm/php.ini /etc/php/X.X/fpm/php.ini.bak
Keep the original permissions and ownership. Edit the confirmed file with your preferred administrative editor, change only the needed directive, and retain the existing syntax. A semicolon at the start of a line comments it out; duplicate active entries can make troubleshooting confusing, so update the existing line where possible.
Common operational directives
| Directive | What it controls | Important qualification |
|---|---|---|
memory_limit |
Maximum memory a PHP request may consume | Raise only when the application and host have sufficient memory; no universal safe value is established. |
max_execution_time |
Maximum execution time for a PHP script | Longer limits can keep workers busy; web-server and PHP-FPM timeouts may still terminate the request. |
upload_max_filesize |
Largest individual uploaded file accepted by PHP | It is only one part of upload handling; the request-body limit must also permit the complete request. |
post_max_size |
Maximum size of POST data, including multipart uploads | Set it high enough for the file plus form fields; otherwise an upload can fail even when the file limit is larger. |
upload_tmp_dir |
Temporary directory used while receiving uploads | The directory must exist and be writable by the PHP worker account, with appropriate permissions. |
open_basedir |
Directories PHP is allowed to access | Changing it can break applications or weaken isolation; include every required path deliberately. |
Values must be valid for the installed PHP version and the workload. The available material does not establish a performance benchmark or a universally recommended number for any of these directives, so choose limits from the application’s documented requirements and the host’s capacity rather than copying a generic value.
4. Apply the change to the correct process
PHP reads the configuration file when PHP starts. Existing PHP-FPM workers can therefore continue using the old value until the matching pool is reloaded or restarted. For the active version, an example restart is:
sudo systemctl restart phpX.X-fpm
Replace X.X with the version serving the domain, such as the version returned by Vesta’s helper. Restarting the wrong service has no effect on the website. A reload may be preferable on a busy server when supported, because it can reduce interruption, but use the service-management method provided by your operating system and Vesta fork.
Apache-module and CGI/FastCGI cases
If the domain uses PHP as an Apache module, the module reads its server configuration when Apache starts or reloads; restart or reload the relevant web service after changing a server-level file. CGI/FastCGI processes likewise need to reread their configuration. Do not assume that restarting PHP-FPM changes a domain that is not using FPM.
5. Verify through the same SAPI and domain
Verification must follow the same request path that exposed the problem. A successful php -i command proves only what the CLI SAPI loaded; it does not prove the browser-facing value.
Use a minimal diagnostic script
Instead of exposing a complete phpinfo() page, you can temporarily print selected directives:
Recommended Free Tools
<?php
header('Content-Type: text/plain');
echo 'memory_limit=' . ini_get('memory_limit') . PHP_EOL;
echo 'upload_max_filesize=' . ini_get('upload_max_filesize') . PHP_EOL;
echo 'post_max_size=' . ini_get('post_max_size') . PHP_EOL;
echo 'max_execution_time=' . ini_get('max_execution_time') . PHP_EOL;
?>
Use an access control, check the page over the affected domain, and remove it afterward. For a full diagnostic, confirm both Loaded Configuration File and the final value shown for the directive. Test the real operation as well: an upload test should use a file near the intended limit, while a timeout change should exercise the application path that previously timed out.
6. Choose the right configuration scope
“Change php.ini” can mean a global server setting, one PHP-FPM pool, one virtual host, one directory, or one application request. The method determines who is affected, what SAPI supports it, whether Vesta template regeneration will preserve it, and whether root privileges are required.
| Method | Scope | SAPI support | Persistence and privilege |
|---|---|---|---|
Main SAPI-specific php.ini |
Every site using that PHP version and SAPI | That SAPI only; FPM, CGI, and Apache-module files can differ | Persists until the package, administrator, or template changes it; normally requires root |
PHP-FPM pool php_value, php_admin_value, or flag |
One pool, often representing a site or group of sites | PHP-FPM | Requires pool configuration access and a pool reload/restart; administrative values cannot be undone by application code |
Apache virtual-host template with php_admin_value |
A virtual host or domain | Apache PHP-module deployments, and configurations that pass the directive to the appropriate handler | Root/template access; durable when placed in the correct Vesta template, but manual generated-vhost edits can be overwritten |
.user.ini |
A directory and its descendants | CGI/FastCGI, including PHP-FPM request handling | Often writable by the site owner; values are cached and are not immediate. Default cache interval is 300 seconds. |
.htaccess |
A directory and descendants | Apache when PHP runs as an Apache module | May be writable by the site owner if overrides are enabled; unsupported directives or handler changes cause errors |
Application ini_set() |
A single request after the code runs | Only directives that permit runtime changes | No service restart, but it cannot override pool settings declared with php_admin_value or php_admin_flag |
7. Per-domain and per-directory settings in VestaCP
Vesta’s native interface is not uniform across forks
VestaCP forks use different control-panel screens, templates, and PHP packaging. Reports on the Vesta forum indicate that a per-user php.ini is not a native feature in standard Vesta. If you need a domain-specific value, use a mechanism supported by the domain’s SAPI and your fork rather than assuming a panel checkbox exists.
PHP-FPM pool values
A PHP-FPM pool can define settings with php_admin_value and php_admin_flag. The PHP-FPM manual states that values defined this way cannot be overridden with ini_set(). This is useful for enforcing a domain policy, but it also explains why an application-level change may appear ineffective. Edit the pool or its durable template, then reload the matching FPM service and verify through the domain.
Rank #4
Vesta web templates
Apache hosting templates are commonly stored under:
/usr/local/vesta/data/templates/web
A template can add php_admin_value directives to generated virtual hosts when the deployment supports them. Prefer the correct template or supported Vesta command over editing a generated virtual-host file by hand. Panel updates or domain-template regeneration can replace manual changes; template-backed settings are the durable option.
.user.ini for CGI/FastCGI
PHP’s official manual documents per-directory INI files for CGI and FastCGI. The default filename is .user.ini, and PHP checks it according to a default 300-second cache interval. Put it in the directory whose scripts need the setting; child directories inherit it unless another file changes the value. Only directives marked INI_ALL, INI_PERDIR, or INI_USER may be set there. A directive classified INI_SYSTEM must remain in the main php.ini or server configuration.
Because the file is web-accessible by path on some servers, ensure the server does not serve its contents as plain text and never store secrets in it. Allow the cache interval to expire, or restart the relevant process when appropriate, before judging a change unsuccessful.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
.htaccess for Apache PHP modules
When Apache runs PHP as a module, PHP’s manual identifies .htaccess as the corresponding per-directory mechanism. This does not apply to every FPM setup. A directive that is valid in an Apache-module context can produce an error or have no effect when the domain is handled by FPM, so identify the SAPI first.
8. Understand directive changeability
PHP classifies directives by where they may be changed. The relevant categories are:
INI_SYSTEM: only the main configuration or server-level configuration can set it. A.user.inientry or applicationini_set()call will not work.INI_PERDIRandINI_USER: these can be set in permitted per-directory or user-level files, subject to the SAPI and server configuration.INI_ALL: these are broadly changeable, including at runtime when the directive permits it.
If a value is visible in php.ini but unchanged in the site, check the directive’s mode before changing more files. A pool administrator value takes precedence over an application attempt to relax it.
9. Troubleshoot a value that did not change
The wrong PHP version was edited
Run Vesta’s domain-version helper again and compare that result with the version shown by the website diagnostic. If they differ, locate and edit the configuration for the version actually assigned to the domain, then restart that version’s service.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →The wrong SAPI was edited
Compare the web page’s SAPI with the file you changed. CLI, Apache-module, CGI/FastCGI, and FPM requests can load separate files. A correct value in php --ini is irrelevant if the site is served by another SAPI.
Workers or per-directory caches are still serving the old value
FPM workers retain startup configuration until reload or restart. A .user.ini value can remain cached for the default 300-second interval. Wait for the documented cache behavior or use the appropriate process reload, then verify again through the website.
A template regenerated the virtual host
If a manual virtual-host edit disappeared after a Vesta update or domain change, move the directive into the appropriate web template or supported configuration mechanism. Generated files are outputs, not reliable storage for local customizations.
The directive is outside the selected scope
Check whether the directive is INI_SYSTEM, whether the chosen file is valid for the SAPI, and whether a pool uses php_admin_value or php_admin_flag. An application cannot override an administrative pool value, and a user-level file cannot set a system-only directive.
Free tools Windows power users keep installed
One-click scans. No signup required.
An upload still fails
Check both upload_max_filesize and post_max_size. The latter covers the entire POST request, so it must accommodate the file and accompanying form data. Also inspect PHP-FPM and web-server request-size or timeout limits; changing PHP alone does not remove those independent ceilings.
The new value causes errors or instability
Restore the backup, reload the affected service, and inspect the application and service logs. Large memory or execution limits can increase resource consumption and keep workers occupied longer. Reapply a smaller, justified value only after confirming the host can sustain it.
Quick Recap
10. A repeatable workflow for one VestaCP domain
- Back up the current configuration or template before editing.
- Run
sudo /usr/local/vesta/bin/v-get-php-version-of-domain yourdomain.comwhen available, and note the assigned PHP version. - Open a restricted diagnostic page through the domain and record the PHP version, SAPI, and Loaded Configuration File.
- Decide whether the requirement is global, pool-level, virtual-host-level, directory-level, or request-level.
- Choose a method permitted by the directive’s INI mode. Use the main file for system-only settings; use
.user.inior.htaccessonly in their supported SAPI contexts. - Edit one directive, preserving syntax and permissions.
- Reload or restart the process that reads the changed configuration. For FPM, use the service matching the active version, such as
sudo systemctl restart phpX.X-fpm. - Recheck the value through the same domain and test the operation that required the change.
- Remove the diagnostic script and review the final file for accidental secrets or duplicate directives.
11. Security and maintenance checks
- Never leave
phpinfo()publicly accessible. - Do not put passwords, API keys, or connection strings in a web-readable
.user.ini. - Limit root-level edits to the required directive and keep a dated backup outside generated files.
- Document the domain, PHP version, SAPI, directive, old value, new value, and reload performed so a later Vesta update can be audited.
- After panel upgrades or template regeneration, verify that domain-specific settings still appear in the web SAPI output.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




