October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk11 min

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

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

To edit php.ini for WordPress, first identify the PHP version and handler used by your website, then locate that handler’s active configuration file. Back up the file, change only the directives you need, reload PHP or the web server when required, and verify the effective values from WordPress or an administrator-only diagnostic. The correct file, path and override method depend on your operating system, PHP handler and hosting provider.

What php.ini controls in WordPress

php.ini is PHP’s configuration file. Its directives can limit how much memory a PHP process uses, how large an uploaded file may be, how large an entire HTTP request may be, and how long a script may run. Those limits affect media uploads, plugin and theme installations, database imports, image processing, backups and other administration tasks.

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.

WordPress does not necessarily read the file you find first on a server. A machine can contain several PHP versions, separate command-line and web-server configurations, and different handlers such as Apache modules or PHP-FPM. Editing an inactive file produces no change in WordPress.

The most commonly relevant directives are:

  • upload_max_filesize: the maximum size of one uploaded file.
  • post_max_size: the maximum size of the complete PHP request, including fields and all uploaded files.
  • memory_limit: the maximum memory one PHP script may allocate.
  • max_execution_time: the maximum execution time PHP allows for a script.
  • max_input_time: the time PHP may spend receiving and processing input, when supported and relevant to the handler.

The WordPress Developer Documentation describes upload_max_filesize as the limit for individual file uploads. The PHP Manual defines it as “The maximum size of an uploaded file.”

Understand the limits before changing them

upload_max_filesize is not the whole-request limit

If you set upload_max_filesize = 100M, one file may be as large as 100 MB only if the other limits also allow the request. A form containing several files, fields and metadata is governed by post_max_size. PHP requires post_max_size to be larger than upload_max_filesize; otherwise the request can be rejected or the upload can appear to vanish before WordPress handles it.

Memory is a different constraint

memory_limit does not set the upload-size limit. It controls the memory available while PHP runs. A large import or high-resolution image can fail after the file has uploaded because parsing, resizing or database work consumes more memory. For large uploads, keep memory_limit higher than post_max_size, while remembering that a host, proxy or web server may impose a lower limit elsewhere.

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

Timeouts can stop a permitted upload

A request can meet both size limits and still time out during transfer, extraction, image conversion or database processing. max_execution_time and, where applicable, max_input_time influence PHP’s side of that process. Web-server, proxy and hosting timeout settings can terminate the request earlier.

Prepare safely before editing

  • Confirm access. You need server-level file access, a hosting control panel, or a documented per-site override. Shared hosting may not permit customer changes.
  • Identify the active PHP version and handler. Use the hosting panel’s PHP settings page or a controlled diagnostic created for an administrator. Do not assume the command-line PHP version is the version serving web requests.
  • Record current values. Note the existing values of every directive you might change, including whether a value is inherited from a higher-level configuration.
  • Back up the configuration. Save a copy outside the file’s editing session and retain the original permissions and ownership. A syntax error can prevent PHP from serving requests.
  • Check host policy first. Some providers enforce hard server-level ceilings. An override cannot raise a value above a ceiling the host controls.

Make changes during a maintenance window if the site handles important transactions. Keep a second administrative route available so you can undo the edit if the dashboard becomes inaccessible.

Step-by-step: edit the active php.ini

1. Find the configuration used by web requests

Open the hosting panel’s PHP version or PHP options screen and note the selected version, handler and configuration path. On a self-managed server, use a temporary, administrator-only PHP configuration diagnostic to display the loaded configuration file and effective directives. Protect that diagnostic from public access and remove it immediately after verification.

A file used by the command-line interface may be different from the file used by Apache, Nginx with PHP-FPM, or another web handler. The web request’s loaded configuration is the one that matters for WordPress.

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

2. Make a dated backup

Copy the active file before editing it. Save the date, PHP version, handler and original values in your change record. If your host provides versioned configuration or a restore button, use that as an additional recovery option.

3. Change the smallest possible set of directives

Use the existing formatting and units. A typical example for a site that needs larger imports might look like this:

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

These values illustrate the relationship between the settings; they are not universal requirements. WordPress publishes another illustrative set for large imports: memory_limit = 300M, post_max_size = 200M, upload_max_filesize = 100M and max_execution_time = 600. Select values based on the operation, the host’s cap and the resources available to the site.

Do not raise every limit automatically. Higher limits can allow one request to consume more memory or keep workers busy for longer. Change only the directive implicated by the error, then increase another only when testing shows it is the next bottleneck.

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

4. Save with valid syntax

Keep directive names exactly as PHP expects them. Use a single value and unit, such as 128M or 300 seconds. Remove accidental quotation marks, duplicate active lines and unsupported directives. If the file contains a commented example beginning with a semicolon, edit or add an active line rather than leaving two conflicting active definitions.

5. Reload the service when the stack requires it

Some handlers reread configuration only when PHP workers or the web server restart. Others apply a control-panel change automatically, sometimes after a short delay. Follow the provider’s documented reload action for the selected handler. On a self-managed server, restart or reload only the relevant PHP service or web server, and check its logs for configuration errors before testing the site.

6. Verify the effective values

Check WordPress’s Site Health information or the host’s PHP settings screen. If those views do not show the directives, use a temporary administrator-only diagnostic to display the web request’s effective values. Remove the diagnostic file as soon as the check is complete; a public PHP-information page exposes server details.

7. Repeat the operation that failed

Retry the original upload, import, update or image-processing task with a representative file. Record the result and any new error message. If it still fails, stop increasing PHP values and investigate the other limits described below.

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.

Choose values that work together

Directive What it limits Relationship or planning rule Example in an illustrative configuration
upload_max_filesize One uploaded file Must fit inside post_max_size and any server, proxy or host limit. 100M
post_max_size The complete PHP request Set it larger than upload_max_filesize to leave room for form data and additional files. 128M or 200M in WordPress’s large-import example
memory_limit Memory allocated to one PHP script For large uploads and imports, keep it higher than post_max_size; actual needs depend on processing. 256M or 300M in the illustrative examples
max_execution_time PHP script execution time Long operations may require more time, but an earlier web-server or proxy timeout still wins. 300 or 600 seconds in the examples
max_input_time Time spent receiving and processing input, where supported Consider it when a slow connection or very large request expires before PHP finishes reading it. Not stated; use the active PHP version’s documentation and host policy.

There is no safe universal “WordPress value.” A 100 MB media upload, a compressed database archive and a memory-intensive image conversion have different resource profiles. Test with the operation you actually need.

When you cannot edit the system php.ini

If the system file is inaccessible or locked, WordPress support documentation identifies several alternatives. Their availability depends on the PHP handler and the host.

Method Scope Access needed Compatibility and limitations
Hosting control panel Usually one account, site or selected PHP version Panel access Best option when provided because the host validates allowed directives. Changes may be capped or applied automatically.
Local php.ini or supported override Directory, site or account, depending on the host File access and permission to override Use the exact filename and location documented for the active handler. A local file may be ignored if overrides are disabled.
.user.ini Directory and descendants on setups that support it File access Common with some PHP-FPM and shared-hosting arrangements, but handler- and host-dependent. Changes may not be immediate.
.htaccess with php_value Directory and descendants under compatible Apache PHP configurations File access and permission to use PHP directives Not compatible with every PHP handler. An unsupported directive can trigger a server error.
wp-config.php memory constants WordPress’s own requested memory for particular requests WordPress file access Changes WordPress’s request, not the server-wide PHP limit and not upload-size directives.
Host support request Server or account level Support access Required when the provider owns the setting or enforces a hard ceiling.

Do not paste an Apache-specific php_value line into a configuration that uses a handler which does not support it. If the result is a server error, remove the line using file access or the host’s recovery tool and ask support which override is permitted.

WordPress memory constants: useful but limited

WordPress documents WP_MEMORY_LIMIT for front-end requests and WP_MAX_MEMORY_LIMIT for administration, including media uploads and other back-end work. Its documented defaults are 40 MB for a single-site front end, 64 MB for Multisite, and 256 MB for administration.

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

These constants tell WordPress how much memory it should request for its own execution. They do not raise PHP’s hard memory_limit for other applications, and WordPress cannot request more than the server allows. Setting a constant above the PHP limit therefore does not solve the underlying restriction. It also does not change upload_max_filesize or post_max_size.

Use the constants when WordPress reports insufficient memory but the PHP limit is high enough to support the requested value. If the effective PHP limit is lower, change the permitted PHP configuration or ask the host instead.

Fix “the uploaded file exceeds the upload_max_filesize directive”

  1. Read the exact effective value. Confirm the value WordPress sees, not merely the value in a file you edited.
  2. Check the file against the limit. The file must be smaller than the effective upload_max_filesize, with room for the host’s own restrictions.
  3. Check post_max_size. It must be larger than the individual-file limit and large enough for the complete request.
  4. Confirm the active PHP handler. A second PHP version or an unselected handler may be loading a different configuration.
  5. Reload and verify again. PHP workers may still be using the previous values until the host applies the change.
  6. Check non-PHP limits. Review web-server and proxy request-size limits, timeout settings, available disk space and any host policy.
  7. Use an alternate transfer path if appropriate. For a very large archive, a host-supported server-side import or file transfer can avoid a browser request, but the application may still need enough memory and execution time to process the file.

Repeatedly increasing upload_max_filesize cannot fix a smaller post_max_size, a proxy cap, a full disk or a host-enforced ceiling.

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

Why a php.ini change appears not to work

You edited the wrong file

Multiple PHP versions and handlers can each have their own configuration. Verify the loaded file through the web request, then edit that file or the override location assigned to it.

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.

The host disallows the override

Shared hosting commonly fixes PHP limits at server level. WordPress notes that customers may be unable to modify them or increase them above a set value. Ask the provider to raise the limit, identify the permitted per-site override, or explain whether a different hosting plan is required.

The service has not reloaded

A saved file does not guarantee that existing PHP workers have reread it. Use the host’s apply or reload action, then verify the effective value from WordPress.

Another layer is smaller

Web servers, reverse proxies and security gateways can impose request-size or timeout limits independently of PHP. A successful PHP setting check does not prove that the entire request path accepts the same size.

The value is valid but the task needs more resources

Imports and image processing can run out of memory or time even when the upload itself is accepted. Check memory_limit, execution time, disk space and the operation’s logs rather than changing upload size alone.

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

The configuration contains a syntax or permission error

Invalid syntax may prevent PHP from starting, while incorrect ownership or permissions can cause the service to ignore a file. Restore the backup, inspect service logs and use the host’s supported editor if necessary.

Shared hosting and managed WordPress environments

On shared hosting, PHP settings are often fixed at the server level so one account cannot exhaust resources needed by other customers. A control-panel field may display a maximum rather than a freely editable value. Treat that maximum as authoritative.

When direct edits do not take effect, send support the site’s domain, active PHP version and handler, the directive names and values you need, and the exact operation that fails. Ask whether the change is allowed per site, per directory or only server-wide. A managed WordPress host that exposes PHP settings can apply the change for you, but availability and limits vary by provider and region.

Security and operational precautions

  • Keep php.ini, local overrides and wp-config.php outside public download paths where your hosting layout permits.
  • Restrict diagnostic scripts to administrators, use them briefly and delete them afterward.
  • Do not publish PHP-information output; it can reveal versions, paths and loaded modules.
  • Increase limits only as far as the workload requires. Very high memory or timeout values can reduce concurrency and make denial-of-service conditions easier.
  • After a PHP version change, recheck overrides. A new version may use a different configuration path or stop supporting a directive in the same way.
  • Keep the original file until the upload or import has succeeded and the site has remained stable.

A practical decision path

  1. If you have a hosting-panel PHP settings page, use it and verify the result in WordPress.
  2. If you administer the server, identify the web handler’s loaded configuration, back it up, edit the minimum directives and reload the relevant service.
  3. If the system file is unavailable, use only the local override mechanism documented for that handler: local php.ini, .user.ini or compatible .htaccess.
  4. If WordPress alone needs more memory, use its documented memory constants only when PHP’s hard limit already permits the requested amount.
  5. If every supported override is capped or ignored, contact the host instead of adding more conflicting files.
  6. After any change, verify effective values, retry the original operation and investigate web-server limits, timeouts, disk space and policy if it still fails.

Key points to remember

  • upload_max_filesize limits one file; post_max_size limits the complete request and must be larger.
  • memory_limit and execution-time settings affect imports, image processing and demanding administration work.
  • The active PHP version and handler determine which configuration file and override method work.
  • WordPress memory constants apply to WordPress requests; they are not universal PHP settings.
  • Shared hosts may enforce limits that customers cannot override. In that case, support or a different hosting arrangement is the correct solution.

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.

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

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.