Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk10 min

How to Change php.ini Settings in VestaCP (Safely, by PHP Version and Domain)

Find and safely change php.ini settings in VestaCP by first identifying the domain’s PHP version and SAPI, then editing the active file or choosing a supported pool, template, .user.ini, or .htaccess override.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check 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.

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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
/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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<?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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

.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.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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.ini entry or application ini_set() call will not work.
  • INI_PERDIR and INI_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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

10. A repeatable workflow for one VestaCP domain

  1. Back up the current configuration or template before editing.
  2. Run sudo /usr/local/vesta/bin/v-get-php-version-of-domain yourdomain.com when available, and note the assigned PHP version.
  3. Open a restricted diagnostic page through the domain and record the PHP version, SAPI, and Loaded Configuration File.
  4. Decide whether the requirement is global, pool-level, virtual-host-level, directory-level, or request-level.
  5. Choose a method permitted by the directive’s INI mode. Use the main file for system-only settings; use .user.ini or .htaccess only in their supported SAPI contexts.
  6. Edit one directive, preserving syntax and permissions.
  7. 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.
  8. Recheck the value through the same domain and test the operation that required the change.
  9. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.