October DealsAmazon USOctober deal check: compare before you payAmazon 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 NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Edit php.ini for Your WordPress Website (and Make the Change Take Effect)

A practical guide to finding the active PHP configuration, changing WordPress upload and memory limits, verifying the result, and fixing overrides that do not take effect.
Length14 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To edit php.ini safely, first identify the PHP version and handler serving your WordPress site, then locate the configuration file that handler actually loads. Back it up, change only the directives you need, reload PHP or use the host’s save/restart action, and verify the effective values in WordPress Site Health or an administrator-only diagnostic. If the host fixes the limits at server level, a file edit cannot override them; you will need the permitted per-site method or help from the host.

What php.ini controls in WordPress

PHP reads configuration directives before WordPress runs. Those directives govern how much data a request can accept, how much memory a script can allocate, and how long a script may run. Uploads, database imports, plugin updates, image processing and other administration tasks can fail when one of these ceilings is too low.

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.

The setting names most relevant to WordPress are:

Directive What it limits Relationship or warning
upload_max_filesize The size of one uploaded file. A larger value is useless if the complete request is still capped lower elsewhere.
post_max_size The total size of a PHP request body, including all uploaded files and other form data. It must be larger than upload_max_filesize; it applies to every PHP request, not only media uploads.
memory_limit The maximum memory a PHP script may allocate. Keep it above the request size for large uploads, while remembering that WordPress, the web server and the host can impose separate limits.
max_execution_time How long a PHP script may execute before PHP stops it. Long imports and image operations may need more time, but a proxy or web server can time out first.
max_input_time How long PHP may spend receiving and parsing input. It can matter for slow, large uploads even when the other values are high.

WordPress documentation describes upload_max_filesize as the individual-file limit and post_max_size as the request limit. The PHP manual defines the former as “the maximum size of an uploaded file.” Always check the manual for the PHP version that is actually running your site because defaults and changeability can vary.

Values normally use suffixes such as K, M and G. Keep the unit attached to the number, use one directive per line, and preserve the spelling and commenting style already used in the file. A line beginning with ; is a comment rather than an active setting, so changing a commented example does nothing.

Why the active PHP configuration matters

A server can contain several PHP versions, each with its own configuration, and the command-line PHP installation may not be the same one used by the web server. PHP-FPM, an Apache module, CGI and hosting-panel stacks can also load different files or permit different override levels. Editing a convenient file on disk does nothing if the web request is using another version or handler.

Before changing anything, establish three facts:

  • The PHP version serving the WordPress site.
  • The handler serving web requests (for example, PHP-FPM or an Apache-integrated handler).
  • The loaded configuration file and whether the host permits site-level overrides.

Use the hosting panel’s PHP settings or diagnostic screen when available. On a server you administer, an administrator-controlled PHP configuration check can show the loaded file and effective values. Do not infer the web configuration from the result of a shell command alone. A command-line result can belong to a different PHP binary, version or configuration tree.

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.

Requirements before you edit

You need an account with permission to change the relevant configuration, a current backup and a way to recover if PHP rejects the edit. For a private server, that usually means administrator or root access and a maintenance window for reloading the affected service. For shared hosting, it may mean only a file manager, SFTP access or a control-panel setting. If you cannot identify the active handler, ask the provider before touching a global file.

Make sure you have enough free disk space for the upload or import as well. PHP and WordPress can create temporary copies while processing a file, so a successful size setting does not guarantee that the operation can complete.

Back up and record the current values

Save a copy of the current configuration before editing. Record the original values of every directive you plan to change, the PHP version, and the date. A backup lets you restore the previous behavior if a plugin, import or unrelated application breaks after the change.

Only edit a file you are authorized to change. On managed or shared hosting, the main php.ini may be read-only by design. Do not change unrelated directives while troubleshooting an upload; a small, reversible change is easier to test and safer for other sites sharing the server.

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.

Keep the backup outside the public web directory when possible. Never leave a copy with a name that a browser can download, and do not place passwords or other secrets in a diagnostic script.

Choose the correct place to make the change

The right method depends on scope, handler and the access your host grants. These approaches are not interchangeable.

Method Scope Handler compatibility Access needed When to use it
Server-level php.ini All sites or a server pool. Works only for the PHP installation and handler that load it. Server or administrator access. Use when you control the server and need a consistent policy.
Host-provided local php.ini or override file One site or directory, as defined by the host. Depends on the host’s PHP handler and configuration. File access or a hosting panel. Use when the host documents a per-site file.
.user.ini Usually a site or directory under PHP-FPM/shared hosting. Handler- and host-dependent; it is not accepted everywhere. Permission to create a hidden file. Use only when the host confirms that this mechanism is enabled.
.htaccess with php_value Directory-level for compatible Apache PHP handlers. Not supported by every handler; it can cause server errors when unsupported. Access to the site’s Apache configuration file. Use only under explicit host documentation for your handler.
wp-config.php memory constants WordPress execution only. Applies to WordPress requests, not other PHP applications. Access to the WordPress files. Use for WordPress memory requests when PHP’s own limit allows them.
Host support or a managed control panel Whatever the provider permits. Provider handles the underlying handler. Account access or a support ticket. Use when server policy fixes the value or direct edits have no effect.

Compare the choices by scope, compatibility, persistence after a PHP update, required access and whether the provider permits the override. Never assume an Apache directive works on PHP-FPM, and never assume a local file survives a PHP version change. The host’s documented method is authoritative for managed accounts.

Safe procedure for editing php.ini

  1. Identify the active version and handler. Check the hosting panel or an administrator-controlled diagnostic generated by the web request. Note the loaded configuration path.
  2. Back up the configuration. Copy the file or export the panel settings, and write down the original values.
  3. Edit the smallest set of directives. Change only the limits related to the failed operation. Use the syntax already present in the file: one directive per line, with a value and unit where appropriate.
  4. Save through the supported mechanism. A server file edit may require a PHP service or web-server reload; a managed panel may apply the change when you click its save or restart control. The exact reload action is stack-specific, so follow the provider’s instructions rather than guessing a command.
  5. Verify the effective values. In WordPress, open Dashboard → Tools → Site Health → Info and inspect the server or media-related information exposed there. If that view does not show the needed directive, use a temporary diagnostic restricted to administrators. Remove that diagnostic immediately after checking it.
  6. Repeat the original task. Retry the upload, import, update or image operation that failed. If it still fails, investigate the other layers listed below instead of continually raising PHP numbers.

After saving, check the site’s front end and an administrator page before starting a lengthy import. A syntax error or unsupported directive can affect every request. If the site shows a server error, remove the last change and restore the backup before investigating further.

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

Choosing sensible values

There is no universal “correct” setting. Your host may impose a maximum, and the workload, available RAM and number of concurrent requests determine what is safe. The following is an illustrative pattern, not a requirement:

memory_limit = 256M
post_max_size = 128M
upload_max_filesize = 100M
max_execution_time = 300

The ordering matters: post_max_size is above the 100 MB individual-file limit, and memory_limit is above the complete request size. A 100 MB upload can still require additional memory for parsing, temporary storage and image processing.

WordPress publishes another illustrative set for large imports:

memory_limit = 300M
post_max_size = 200M
upload_max_filesize = 100M
max_execution_time = 600

Those figures demonstrate a relationship between directives; they are not universal requirements or a promise that a host will permit them. Increase one step at a time, test the operation, and return to the smallest values that reliably support the workload.

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

Do not set every limit to an extremely high value simply because a larger number appears convenient. A high memory allowance can let several simultaneous requests consume more server RAM, and a long execution allowance can leave stuck requests running longer. Choose a value tied to the largest file or task you actually need, then leave headroom for form fields, metadata and processing.

WordPress memory constants are not replacements for php.ini

WordPress can request more memory for its own execution with constants in wp-config.php. WP_MEMORY_LIMIT applies to front-end requests, while WP_MAX_MEMORY_LIMIT covers administration, including media uploads and other back-end work.

WordPress documents defaults of 40 MB for a single-site front end, 64 MB for Multisite, and 256 MB for administration. A constant can raise what WordPress asks for only up to the PHP memory_limit; it does not raise PHP limits for other applications and cannot bypass a server-level cap. If PHP allows 128 MB, setting a WordPress constant to 256 MB will not create 256 MB of available memory.

Use these constants when the failure is specifically WordPress’s requested memory and your PHP limit is already high enough. Use php.ini or the host-supported override for upload, request-size and execution-time directives. Make a backup of wp-config.php too, and avoid adding duplicate definitions that make it unclear which value is being used.

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

Fixing “uploaded file exceeds the upload_max_filesize directive”

This message means the effective per-file value is below the file you selected. First verify the value seen by the web request; editing a different PHP installation is the most common reason a change appears not to work.

  1. Check the effective upload_max_filesize in Site Health, the host panel or an administrator-only diagnostic.
  2. Confirm that the value is large enough for the file and that the host permits it.
  3. Set post_max_size higher than upload_max_filesize, because the request includes more than the file itself.
  4. Save through the supported override, reload when required, and verify again.
  5. Retry with the original file. If the same message remains, ask the host which PHP handler serves the site and whether a server policy overrides your setting.

Do not solve this error by changing only WordPress’s memory constants; they do not alter the upload directive. If only one file is large, reducing its size or splitting an archive can be a practical alternative when the plan has a fixed cap.

When the upload limit is no longer the problem

The request is rejected despite a high upload_max_filesize

Check post_max_size and any web-server, reverse-proxy or hosting request-size limit. The smallest layer wins. A value in php.ini cannot override a proxy policy or a host-wide cap.

The import reaches PHP but ends with a memory error

Raise memory_limit only within the host’s allowance and consider the WordPress administration constant if the failure occurs during a back-end task. Large archives, image transformations and plugin code can consume substantially more memory than the file size suggests. If the host cannot provide more memory, split the import or reduce the workload rather than repeatedly increasing the directive.

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

The operation times out

For a long-running import or image job, review max_execution_time and, where relevant, max_input_time. A PHP value cannot extend a shorter timeout enforced by the web server, proxy or browser-facing service. Check those layers and the host’s policy.

The value reverts after a PHP update

PHP versions can use different configuration files, and a provider may rebuild the service during an update. Recheck the loaded file and effective values after a version switch. Prefer the host’s documented per-site mechanism when available, because it is less likely to be lost than an edit to a package-managed global file.

The site returns a server error after an override

Remove the last override and restore the backup. An unsupported php_value directive in .htaccess is a common cause when the site uses a handler that does not accept Apache PHP settings. Contact the host for the permitted method before trying another file.

The operation fails even though all PHP values look correct

Check free disk space, temporary-directory capacity, file permissions, database limits, web-server request limits, proxy limits and host resource quotas. Also verify that the plugin or importer supports the file format and that the account has permission to write to the WordPress uploads directory. Raising PHP values cannot repair those independent failures.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Shared hosting and managed WordPress accounts

On shared hosting, providers commonly set PHP limits at server level. WordPress notes that customers may be unable to modify them or increase them above a certain value. A local file can appear syntactically correct yet be ignored, restricted to a lower maximum, or replaced by the provider’s policy.

When that happens, send support the exact directive, current effective value, desired value, PHP version and the operation that fails. Ask whether the account supports a local php.ini, .user.ini, .htaccess override or a panel control, and what maximum the plan allows. If no override is permitted, the practical choices are to reduce the workload, split the upload, or move to hosting that exposes the required PHP settings.

A managed WordPress plan may offer a settings screen or support team that applies these changes for you. Compare plans by the actual PHP limits, override controls, handler used, persistence during PHP upgrades and support response—not just by storage or bandwidth. A plan change can introduce a recurring charge, so ask the provider for current pricing, regional availability and the exact limits before committing.

Verification, rollback and cleanup

Verification should be performed through the same web path that serves WordPress. Confirm the PHP version, loaded configuration file and effective values after every change. If a panel reports a requested value but Site Health reports another, treat the web-request value as authoritative and ask the host why the two differ.

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

If the operation still fails, restore the last known-good values before making another change. Keep a short change log showing what was changed, when it was applied and what test was run. This prevents repeated increases and helps support staff identify a server-level cap.

Delete temporary diagnostic files immediately after use, remove downloaded copies of configuration files from public directories, and restrict any future check to administrators. A configuration display can reveal paths, versions and other information that should not be exposed to visitors.

Verification and cleanup checklist

  • Confirm the web-request PHP version and handler, not only command-line PHP.
  • Locate the loaded configuration file or host-supported override.
  • Back up the original file and record old values.
  • Keep post_max_size above upload_max_filesize.
  • Keep memory_limit above the request size when large uploads need it.
  • Reload PHP or use the provider’s apply action when required.
  • Verify effective values in Site Health or a temporary administrator-only diagnostic.
  • Delete every diagnostic file after checking it.
  • Test the original operation and investigate non-PHP limits if it still fails.

The reliable fix is the one applied by the PHP handler that serves the site, within the limits the host actually allows. Editing an inactive file, raising only one related directive, or leaving a diagnostic script online will not solve the underlying problem.

Frequently Asked Questions

How do I know which php.ini WordPress is using?

Check the hosting panel or an administrator-controlled diagnostic generated by a web request. It should show the active PHP version, handler and loaded configuration path. Do not rely on command-line PHP alone.

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

Why did my php.ini change not work?

The web server may use another PHP version or configuration file, the handler may not support that override, a reload may be required, or the host may enforce a lower server-level value. Verify the effective value in Site Health or the host panel.

How large should post_max_size be compared with upload_max_filesize?

Set post_max_size higher than upload_max_filesize because the request also contains form fields and metadata. The exact amount depends on the workload and the host’s permitted maximum.

Can wp-config.php increase my upload limit?

No. WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT request memory for WordPress execution; they do not change upload_max_filesize or post_max_size and cannot bypass PHP or host caps.

Do I need to restart PHP after editing php.ini?

Often, yes, but the required action depends on the PHP handler and hosting stack. Follow the provider’s documented reload or panel save process, then verify the effective value through a web request.

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

What should I do if shared hosting will not raise the limit?

Ask support whether a local php.ini, .user.ini, .htaccess or panel override is allowed and what maximum the plan permits. If no override exists, split or reduce the workload, or compare a managed plan that exposes the needed settings.

Is .htaccess with php_value safe on every WordPress host?

No. It works only with compatible Apache PHP handlers. On another handler it may be ignored or trigger a server error, so use it only when the host explicitly documents support.

Why does a 100 MB upload still fail with a 100 MB upload_max_filesize?

The complete request must also fit within post_max_size, and web servers, proxies or host policies can impose smaller request limits. Memory, disk space and timeouts can also stop processing after PHP accepts the file.

The Bottom Line

Edit the configuration used by the site’s actual PHP handler, not merely a file that looks familiar. Back up first, keep post_max_size above upload_max_filesize and memory_limit above the request size when appropriate, reload through the supported method, and verify the effective values. If a shared or managed host enforces the limit, support or a plan with suitable PHP controls is the correct solution.

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

Quick Recap

SaleBestseller No. 2
Bestseller No. 3
SaleBestseller No. 4
Bestseller No. 5

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 *

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.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.