The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →The reliable way to change a PHP setting in VestaCP is to identify the PHP version and SAPI serving the domain, edit that runtime’s configuration, restart the matching service, and verify the result through the same web request path. Do not assume that the PHP version shown by the command line, or a familiar /etc/php.ini path, controls your website.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
VestaCP installations differ by operating system, fork, PHP version, and whether a domain uses PHP-FPM, CGI/FastCGI, or an Apache module. The steps below show how to make a server-wide change, a domain or directory override, or a PHP-FPM-pool restriction without losing the setting during a template update.
As an Amazon Associate I earn from qualifying purchases.
Free tools Windows power users keep installed
One-click scans. No signup required.
Understand what you are changing
PHP settings are not stored in one universal location in every VestaCP installation. A web request can use a different PHP binary, configuration file, and process manager from the php command you run over SSH. The effective value is determined by the SAPI (Server API), the PHP version assigned to the domain, and the configuration scope of the directive.
For example, a domain running PHP-FPM 8.2 may read an FPM configuration while your shell’s php -i command reports PHP 7.4 settings. Editing the 7.4 file will not change the website. Similarly, a value in a directory-level file cannot change a directive classified as system-only, and a PHP-FPM pool administrator value cannot be undone by application code.
#1 Best Overall
“The configuration file (
php.ini) is read when PHP starts up.” — PHP Documentation Group, official PHP manual.
That startup behavior explains why an edit can appear to do nothing until the relevant PHP-FPM service is reloaded or restarted.
1. Identify the PHP runtime serving the domain
Start with the domain, not with a filename. Replace yourdomain.com with the exact hostname configured in VestaCP:
sudo /usr/local/vesta/bin/v-get-php-version-of-domain yourdomain.com
This Vesta-compatible helper is available on some installations and forks. If it is not present, inspect the domain’s web configuration in VestaCP or the generated virtual-host configuration to determine the assigned PHP version and handler. Record both the version and the handler—for example, PHP 8.2 with PHP-FPM—before editing anything.
Why the command-line version is not enough
The command below describes the CLI binary selected for your shell:
php -v
It does not prove that the website uses that version. Multiple PHP versions can coexist, and each can have separate CLI, Apache-module, CGI, and FPM configuration files. Treat php -v as an inventory check only; use a web request to confirm the site’s runtime.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
2. Find the active php.ini file
On a common PHP-FPM layout documented for myVesta, the main file is:
/etc/php/X.X/fpm/php.ini
Replace X.X with the version assigned to the domain, such as 8.2. This is an example layout, not a universal VestaCP path. Depending on the distribution and Vesta fork, the file may instead be /etc/php.ini, /opt/phpX.X/etc/php.ini, or another SAPI-specific location.
Rank #2
Confirm with the relevant PHP binary
For a CLI binary, ask PHP which files it scans:
php --ini
If several binaries are installed, invoke the versioned binary associated with the site, such as php8.2 --ini, when that executable exists. This still confirms the CLI SAPI, not necessarily FPM. The definitive check is a diagnostic request through the domain itself.
Use a temporary web diagnostic
Create a short, access-controlled file in the site’s document root:
<?php
phpinfo();
Open it over HTTPS using the domain that needs the change. In the output, note PHP Version, Server API, Loaded Configuration File, and Additional .ini files parsed. The loaded file and SAPI identify the configuration that actually controls the request. Restrict access by IP, HTTP authentication, or a temporary maintenance rule while testing, then delete the file immediately.
3. Back up the file and edit one directive at a time
Once the active file is known, make a copy before changing it. Use a versioned backup name so you can restore the prior state:
sudo cp /etc/php/X.X/fpm/php.ini /etc/php/X.X/fpm/php.ini.$(date +%F-%H%M%S).bak
Substitute the path discovered for your installation. Open the file with an editor available on the server:
sudo nano /etc/php/X.X/fpm/php.ini
Find the directive, remove a leading semicolon only when the line is commented, and change its value using the syntax PHP expects. Keep the edit narrow: one setting or one related pair at a time. Preserve comments and unrelated distribution changes so that future package upgrades remain understandable.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsCommon operational directives
| Directive | What it controls | Important qualification |
|---|---|---|
memory_limit |
Maximum memory available to one PHP request | A higher limit does not add physical memory; it can allow more concurrent memory use. |
max_execution_time |
Maximum execution time for a PHP script | It does not automatically change web-server or PHP-FPM request timeouts. |
upload_max_filesize |
Maximum size of one uploaded file | For multipart uploads, it normally must be coordinated with post_max_size. |
post_max_size |
Maximum size of the complete POST body | Set it larger than the permitted file upload when the request includes form fields and upload overhead. |
upload_tmp_dir |
Temporary directory used while receiving uploads | The directory must exist and be writable by the PHP worker account, with suitable permissions. |
open_basedir |
Restricts filesystem paths PHP may access | Overly narrow paths can break applications, temporary files, and dependency loaders. |
There is no universal “correct” value for these directives. Choose a value based on the application’s workload, available memory, upload requirements, and timeout design, then test the result. The available values and units also depend on the installed PHP version.
4. Apply the change to the correct process
After editing an FPM configuration, restart the service for the same PHP version:
sudo systemctl restart phpX.X-fpm
Replace X.X with the active version, for example php8.2-fpm. Service names vary by distribution, so list matching units if that name fails:
systemctl list-units --type=service | grep -i php
A reload may be sufficient for a normal configuration change, but a restart is the straightforward confirmation that old workers have stopped. Check service status immediately:
sudo systemctl status phpX.X-fpm --no-pager
If the service does not start, inspect the journal before making more edits:
sudo journalctl -u phpX.X-fpm -n 100 --no-pager
Syntax errors, invalid values, permissions, and an incorrect service name are common causes of failure. Restore the backup if necessary, restart again, and only then test the website.
5. Verify through the same domain and SAPI
Reopen the temporary diagnostic page and check both Loaded Configuration File and the directive’s displayed value. A small targeted script can expose only the setting you are testing:
<?php
header('Content-Type: text/plain');
echo 'PHP_VERSION=' . PHP_VERSION . PHP_EOL;
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;
Use only the lines relevant to your change, protect the file, and remove it after verification. Test the real operation as well: upload a file of the intended size, run the affected endpoint, or exercise the job that previously timed out. A displayed value proves what PHP reports, while an application test catches web-server, filesystem, and framework limits outside php.ini.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Choose the right configuration scope
The best method depends on whether the value should apply to every site, one domain, one directory, or one FPM pool. It also depends on who has root access and whether Vesta regenerates the virtual host.
| Method | Scope | SAPI support | Privilege | Reload or delay | Persistence considerations |
|---|---|---|---|---|---|
Main php.ini |
All requests using that PHP version and SAPI | Specific to the file’s SAPI; FPM, CLI, and Apache can differ | Root | Restart or reload the relevant service | Package upgrades and separate version files require administration. |
.user.ini |
One directory and descendants | CGI/FastCGI, including typical FPM deployments | Usually site owner | PHP’s default cache interval is 300 seconds | Stored with the site, but only directives allowed at per-directory scope work. |
.htaccess |
One Apache directory tree | Apache PHP module | Depends on file ownership and Apache policy | Apache reads directory configuration per request | Not the corresponding mechanism for an FPM handler. |
| Apache virtual-host template | Domains generated from that template | Apache module or directives accepted by the selected handler | Root | Regenerate or reload Apache as required | More durable than editing a generated vhost, but template syntax and fork behavior vary. |
PHP-FPM pool php_admin_value/php_admin_flag |
One pool, often one domain or user | PHP-FPM | Root | Reload or restart the pool service | Administrative values cannot be changed by application-level ini_set(). |
Per-domain and per-directory changes
Use .user.ini for CGI or FastCGI
PHP’s manual states: “PHP includes support for configuration INI files on a per-directory basis.” For CGI and FastCGI, the default filename is .user.ini. Put it in the document root or the directory whose descendants should inherit the setting:
Rank #4
memory_limit=256M
upload_max_filesize=64M
post_max_size=68M
PHP checks these files according to its per-user configuration rules; the default cache interval is 300 seconds, so a change may not appear immediately. Only directives marked INI_ALL, INI_PERDIR, or INI_USER can be set there. A directive marked INI_SYSTEM must remain in the main configuration or server configuration.
Set ownership and permissions so the site can read the file without making it writable by every system user. Never place database passwords, API keys, or other secrets in a file that might be downloadable because of a web-server misconfiguration. Remove the file or narrow its directory if the override is no longer needed.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Use .htaccess only for an Apache module
When Apache runs PHP as a module, PHP’s per-directory mechanism is .htaccess. A directive may look like:
php_value memory_limit 256M
php_value upload_max_filesize 64M
php_value post_max_size 68M
This syntax is not a solution for a PHP-FPM domain. On an FPM setup it may produce an “invalid command” error or simply be ignored, depending on Apache configuration. Confirm the Server API before adding it, and check the Apache error log if the site returns a 500 response.
Use Vesta templates for durable virtual-host changes
Vesta-generated virtual hosts can be rewritten when a domain is edited, a package is updated, or templates are regenerated. A manual change made directly in a generated vhost may therefore disappear. Vesta forum guidance identifies web templates under:
/usr/local/vesta/data/templates/web
Template names and syntax vary by fork and web stack. Make a backup, identify the template used by the domain, and place the directive in the supported template rather than repeatedly patching generated output. After changing a template, regenerate the affected domain configuration using the Vesta workflow appropriate to your installation, reload the web server, and verify the resulting vhost. A template change can affect every domain that uses it, so review the scope before applying it.
Recommended Free Tools
Use FPM pool directives for enforced values
PHP-FPM pools can define settings such as:
php_admin_value[memory_limit] = 256M
php_admin_flag[display_errors] = off
The PHP-FPM manual states that settings defined with php_admin_value and php_admin_flag “cannot be overridden with ini_set().” This is appropriate when the administrator must enforce a limit or security setting for a pool. It is not appropriate when an application is expected to choose its own value at runtime. Pool configuration is root-only and must be reloaded or restarted after editing.
Directive precedence and why an override fails
PHP assigns each directive a changeability mode. A per-directory file can change only directives allowed at per-directory or user scope. An application call such as ini_set() can change only directives permitted at runtime, and it cannot defeat a pool-level administrative value. The main php.ini or server configuration is required for system-only directives.
When two values appear to conflict, compare the exact request path and configuration source rather than adding more copies of the setting. Check the loaded file, additional scanned files, directory-level files, pool configuration, and application bootstrap code. The last effective value is not always the one you edited.
Fix the most common “php.ini did not change” problems
The wrong PHP version was edited
Run the domain-version helper first, then verify the web page’s PHP version. A site mapped to PHP 7.4 will not read PHP 8.2’s FPM file. Correct the file and service pair, not just the number displayed by your shell.
The wrong SAPI was inspected
CLI, Apache-module, CGI, and FPM processes can each load different files. Compare the web diagnostic’s Server API and Loaded Configuration File with the file you changed. If the domain uses FPM, a successful php -i command alone is not evidence that the web request changed.
Workers were not restarted or the cache has not expired
FPM reads startup configuration when workers start. Restart or reload the matching service. For .user.ini, allow PHP’s default 300-second cache interval or use the appropriate process restart during a controlled maintenance window.
Vesta regenerated the virtual host
If a manual Apache or domain configuration edit vanished, the generated file was likely rebuilt. Move the durable directive into the appropriate Vesta template or supported configuration mechanism, then regenerate and verify it.
The directive is not changeable at that scope
An INI_SYSTEM directive cannot be placed in .user.ini. A php_admin_value cannot be undone with ini_set(). Move the setting to the main SAPI configuration, server configuration, or FPM pool as its changeability mode requires.
Upload limits still reject the request
Check both upload_max_filesize and post_max_size. Then inspect PHP-FPM request termination, Apache or Nginx body-size limits, proxy limits, filesystem free space, and the temporary upload directory. Raising only one PHP directive leaves another ceiling unchanged.
The service will not restart
Read the unit’s journal, correct the syntax or invalid value, and restore the timestamped backup if needed. Do not repeatedly restart a failing service while the site is in production; first return the configuration to a known-good state, then make a smaller change.
Security and maintenance checks
- Keep a timestamped backup before every production edit.
- Change one related setting at a time and record the reason, old value, new value, and affected PHP version.
- Restrict or remove every
phpinfo()or diagnostic script after testing; it exposes paths, modules, environment details, and configuration. - Review ownership and permissions on
.user.ini, pool files, and template files. - Do not expose secrets in a per-directory configuration file.
- After Vesta, PHP, or operating-system updates, recheck the domain’s assigned version and loaded configuration file.
- Test the application’s real operation instead of relying only on a displayed directive value.
A repeatable change procedure
- Write down the domain, intended setting, desired scope, and rollback value.
- Run
sudo /usr/local/vesta/bin/v-get-php-version-of-domain yourdomain.comwhen available, and identify the handler. - Confirm the web SAPI and loaded file with a temporary protected diagnostic page.
- Choose the narrowest supported scope:
.user.inifor a FastCGI directory, an Apache mechanism for an Apache module, an FPM pool for an enforced pool value, or the mainphp.inifor a version-wide value. - Back up the configuration and edit only the required directive.
- Restart or reload the matching PHP-FPM, Apache, or other service; allow the
.user.inicache interval when applicable. - Verify the value through the same domain and SAPI, then test the affected application operation.
- Remove diagnostics, document the final location, and keep the backup until the change has survived a normal deployment or regeneration cycle.
The central rule is simple: a VestaCP PHP change is successful only when the domain’s actual runtime reports the new value after the correct process has reloaded it. Version, SAPI, scope, and template persistence determine which file and method are valid.
Quick Recap
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.




