fire icon

BFCM Sale Is Live!  |  Get 30% OFF Lifetime Plans!

AFM Beta testing

Advanced File Manager Beta v6.0.0 Is Live

Get early access. Test new features before anyone else. Join the beta and help shape what ships next.


Get the download link on your email.

Email

Where Is php.ini in WordPress? (& How to Edit This File)

If you’re trying to increase the WordPress upload limit, PHP memory limit, execution time, or input variables, you may have been told to edit php.ini.

But where is php.ini in WordPress?

The answer is: php.ini is a PHP configuration file; unlike a WordPress core file, its location depends on your PHP installation, server environment, PHP SAPI, and hosting configuration.

The safest approach is first to find the configuration PHP is actually using, then determine whether you can edit it. If the file is accessible from the WordPress environment, Advanced File Manager can help you locate and edit it from the dashboard; otherwise, you’ll need to use cPanel, FTP, or other methods.

What is php.ini in WordPress?

php.ini is PHP’s main configuration file. Because WordPress runs on PHP, these settings can affect how WordPress handles uploads, memory usage, script execution, input variables, and other server-side operations.

The key point is that php.ini isn’t part of WordPress itself. 

WordPress can request or use certain PHP settings, but PHP and the server determine which configuration files load and which settings you can change at each level.

That means you shouldn’t assume that php.ini exists beside WordPress core files. 

Where Is php.ini Located in WordPress?

There is no single php.ini location for every WordPress website.

php.ini belongs to PHP, not WordPress. PHP determines which configuration files to load based on the PHP installation, server environment, PHP version, and SAPI in use. It may load a main php.ini file and scan additional .ini files from configured directories.

So, if you search your WordPress directory and don’t find php.ini, that does not necessarily indicate a problem. The active configuration may live somewhere else.

Where to Find php.ini

The location and editing method depend on your hosting or development environment.

EnvironmentWhere to Find
Shared hostingCheck your hosting control panel for PHP settings. Your host may also support .user.ini.
cPanelCheck MultiPHP INI Editor, File Manager, or your host’s PHP settings interface.
VPS or dedicated serverUse SSH and run php –ini to identify the PHP configuration used by the CLI.
XAMPPOpen the PHP configuration provided by your XAMPP installation.
WAMPUse the WAMP PHP configuration options to access the relevant php.ini.
MAMPCheck the PHP configuration for the PHP version enabled in MAMP.
WordPress directoryphp.ini is not normally located here by default. A local configuration file only works if your hosting environment supports it.

Note: php –ini reports the configuration used by the PHP CLI. Your WordPress site may use a different PHP SAPI and configuration.

If you have SSH or command-line access, run:

php –ini

This shows the loaded configuration file and the directories PHP scans for additional .ini files.

For a website, you can also use phpinfo() or php_ini_loaded_file() to identify the configuration loaded by a web request. This is important because the PHP configuration used by the command line can differ from the configuration used by your WordPress website.

Why Would You Need to Edit php.ini?

You may need to edit php.ini when your WordPress site reaches a PHP limit that prevents a task from completing. These settings control things such as file upload sizes, PHP memory, script execution time, and the number of input variables PHP accepts.

Common reasons to change PHP settings include:

  • Increase upload limits: Adjust upload_max_filesize and post_max_size when WordPress rejects larger file uploads. Also check your hosting provider’s limits and WordPress’s upload size restrictions.
  • Increase PHP memory: Adjust memory_limit when a process runs out of available PHP memory.
  • Allow longer execution times: Increase max_execution_time for tasks that genuinely need more time to complete.
  • Handle large forms or menus: Increase max_input_vars when a page submits more variables than PHP currently allows.
  • Troubleshoot PHP limits: Check and adjust PHP settings when a WordPress plugin, theme, or other process encounters a configuration-related limit.

Before changing any value, identify the PHP configuration your website uses and check whether your hosting environment lets you modify that setting.

How to Edit php.ini in WordPress

Once you’ve identified the PHP configuration file your site uses, choose the access method that fits your hosting environment.

Method 1: Edit php.ini With Advanced File Manager

If your hosting provider supports local PHP configuration files and allows WordPress to access them, you can use Advanced File Manager to create or edit the relevant file from your WordPress dashboard.

  1. From your WordPress dashboard, click File Manager.
open-advanced-file-manager-wordpress-dashboard
  1. Navigate to the directory where your hosting provider expects the local PHP configuration file. Depending on your server configuration, this might be php.ini or .user.ini. For example, some hosting providers allow per-directory PHP settings through a .user.ini file in public_html.
  2. Before creating the file, check your hosting provider’s documentation to confirm which configuration method and filename your server supports.
select-public-html-folder-advanced-file-manager
  1. Find the relevant configuration file (php.ini or .user.ini), right-click it, and select Code Editor.

Note: Before making changes, create a backup if your file already contains important configuration settings.

open-php-ini-in-code-editor
  1. Edit only the settings (directives) you need for the problem you’re solving. These values are examples, not universal WordPress recommendations. Your hosting provider may impose different limits.
  2. Save the file after adding or updating the required directives. Keep in mind that creating or editing php.ini does not guarantee that PHP will use it. Your hosting environment must support local php.ini files for these changes to take effect.
save-and-close-php-ini-changes

Method 2: Edit PHP Settings With cPanel

If your hosting provider uses cPanel, you may be able to manage PHP settings through the control panel instead of manually editing a configuration file.

Using MultiPHP INI Editor

Some cPanel hosts provide MultiPHP INI Editor, which lets you change supported PHP directives through a graphical interface.

  1. Log in to cPanel.
  2. Open the MultiPHP INI Editor.
cpanel-multiphp-ini-editor
  1. Select your domain or PHP configuration.
  2. Find the directive you need to change.
  3. Enter the new value.
edit-php-directives-multiphp-ini-editor
  1. Save the changes.
  2. Verify the effective PHP value.

The available settings depend on your hosting provider and server configuration.

Method 3: Edit php.ini Using FTP or SFTP

FTP or SFTP can help when your hosting provider gives you access to the relevant configuration file.

  1. Connect to your server using your FTP or SFTP credentials.
  2. Navigate to the configuration file.
  3. Create a backup before making changes.
  4. Open the file in a text editor or Notepad.
  5. Change the required directive.
  6. Save and upload the file.
  7. Verify that PHP is using the new value.

Access to your WordPress files does not automatically give you access to the server-wide php.ini.

Method 4: Edit php.ini Using SSH

If you manage a VPS or dedicated server, SSH can help you locate PHP configuration files.

First, run:

php –ini

This command shows the configuration used by PHP’s command-line interface (CLI). Your WordPress website may use a different PHP version or configuration through PHP-FPM or another web server handler. Confirm the configuration used by website requests before editing any file, then verify the effective settings after saving your changes.

find-php-ini-location-using-ssh

You can then open the relevant configuration file with a command-line editor such as nano or vim.

The exact file path depends on your operating system, PHP version, and server configuration, so verify the active configuration before editing it.

How to Create php.ini in WordPress

You can create a file named php.ini through a reliable file manager; in this case, we used Advanced File Manager.

PHP decides which configuration files to load based on the server and SAPI configuration.

  1. Log in to your WordPress dashboard.
  2. Go to Plugins → Add Plugin.
wordpress-plugins-add-plugin
  1. Enter Advanced File Manager in the search bar.
search-advanced-file-manager-plugin
  1. Click on Install Now, then Activate.
install-activate-advanced-file-manager-plugin
  1. Navigate to the directory where your hosting provider expects the local PHP configuration file. For example, some hosting providers use public_html for per-directory configuration.
  2. Click the New File button.
advanced-file-manager-new-file-button
  1. Select the TXT: Plain text option.
create-txt-plain-text-file
  1. Name the file php.ini or .user.ini, depending on the configuration method supported by your hosting provider.
name-new-file-php-ini
  1. Right-click the file and select Code Editor.
open-php-ini-file-code-editor
  1. Enter the required PHP directives and save the file.
  2. Verify that PHP loads the configuration file and applies the changes.

Important: Creating a configuration file in public_html does not guarantee that PHP will load it. Your hosting provider and PHP configuration determine which files PHP recognizes.

Add the Required PHP Directives

Add only the PHP directives you need. For example, to allow uploads of up to 64 MB, you could use:

upload_max_filesize = 64M

post_max_size = 80M

memory_limit = 256M

The values above are examples, not universal recommendations. Set post_max_size higher than upload_max_filesize to allow room for the complete request, including other form data. Also check your hosting provider’s limits and WordPress’s upload settings.

Verify Whether PHP Loads the New Configuration

Don’t assume the configuration works simply because the file exists.

After saving your changes, check the effective PHP settings using your hosting control panel or a temporary diagnostic script that calls phpinfo() or php_ini_loaded_file(). If you create a publicly accessible phpinfo() file, remove it immediately after testing because it can expose server configuration details. Verify that the settings changed before continuing.

If the values haven’t changed, you may have created the file in the wrong location, used a configuration method your host doesn’t support, or hit a server-level restriction.

When Creating php.ini Won’t Work

A local php.ini file may not affect your WordPress site if your hosting provider does not support it, PHP loads configuration from another location, or the server restricts the directive.

On supported CGI/FastCGI setups, PHP may use a .user.ini file for per-directory settings. However, it only supports directives with INI_ALL, INI_PERDIR, or INI_USER configuration modes. Directives restricted to INI_SYSTEM cannot be changed through .user.ini. Check the PHP documentation or ask your hosting provider whether the directive you want to change is supported.

Recommended php.ini Settings for WordPress

Avoid copying a generic list of large values into php.ini. The right setting depends on what you’re trying to accomplish and what your hosting environment supports.

DirectiveWhat it controlsWhat to consider
upload_max_filesizeMaximum size of an individual uploaded fileIncrease it only when larger uploads are required
post_max_sizeMaximum size of a PHP POST requestKeep it at least as large as upload_max_filesize
memory_limitMaximum memory available to a PHP scriptIncrease it when the workload genuinely needs more memory
max_execution_timeMaximum time a PHP script can executeIncrease it for genuinely long-running PHP tasks
max_input_timeTime PHP allows for receiving inputRelevant to large or slow requests
max_input_varsMaximum number of input variables PHP acceptsUseful for large forms, menus, and configuration screens

WordPress specifically highlights the relationship between upload_max_filesize and post_max_size. PHP also treats max_execution_time and max_input_time as separate limits, so changing one does not automatically change the other.

If you use shared hosting, you may not have access to the server-wide php.ini. Your provider may instead offer a PHP settings interface or support .user.ini for per-directory configuration.

On cPanel, look for MultiPHP INI Editor, File Manager, or another PHP settings interface provided by your host.

On a VPS or dedicated server, you generally have more control over PHP configuration. Use:

php –ini

to identify the PHP CLI configuration file and scanned directories. Remember that the CLI configuration may differ from the configuration used by your website.

For XAMPP, WAMP, and MAMP, use the PHP configuration provided by the local development environment and make sure you’re checking the configuration for the PHP version your site actually uses.

Common php.ini Problems in WordPress

Common php.ini problems in WordPress often involve incorrect PHP limits, changes not taking effect, or editing the wrong configuration file. This section explains the most common issues and how to troubleshoot them.

“The Uploaded File Exceeds the upload_max_filesize Directive in php.ini”

Check upload_max_filesize and post_max_size. The post_max_size value should be higher than upload_max_filesize to accommodate the uploaded file and other form data in the request.

“Allowed Memory Size Exhausted”

Check PHP’s memory_limit and WordPress’s memory settings. If increasing the limit doesn’t fix it, investigate the plugin, theme, or process using excessive memory. WordPress itself recommends debugging the underlying cause rather than simply increasing memory indefinitely.

“Maximum Execution Time Exceeded”

Check max_execution_time, but also consider max_input_time and web-server timeouts. Increasing one timeout doesn’t override a shorter limit imposed elsewhere.

max_input_vars Errors

Check the number of fields submitted by the affected page or process and compare it with the current max_input_vars value.

Large menus, forms, and configuration screens can generate many input variables.

“I Changed php.ini, but Nothing Happened”

This usually means you need to investigate which PHP configuration is actually being used.

Check:

  • Whether you edited the active configuration file
  • Whether the website uses a different PHP version
  • Whether PHP uses a different SAPI
  • Whether the directive can be overridden at your configuration level
  • Whether .user.ini has been reloaded
  • Whether your hosting provider controls the setting

php.ini vs .user.ini vs wp-config.php vs .htaccess

These configuration methods aren’t interchangeable.

Configuration methodBest suited for
php.iniMain PHP configuration when you have the required server access
.user.iniPer-directory PHP settings on supported CGI/FastCGI environments
wp-config.phpWordPress-specific configuration, including WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT, which allow WordPress to request additional PHP memory when the server permits it. 
.htaccessOn Apache servers running PHP as an Apache module, you can configure certain PHP directives through .htaccess if the server permits them. This method does not work for every PHP setup, including all CGI/FastCGI configurations. Check your server’s PHP handler and the directive’s configuration mode before using it.
Hosting control panelPHP settings exposed by your hosting provider

PHP determines where you can change a directive based on its configuration mode, while WordPress provides its own configuration constants for certain WordPress-specific behaviors.

Don’t copy a setting from one method into another without checking whether that configuration layer supports it.

Find and Edit php.ini Without Leaving WordPress

Where php.ini is in WordPress depends on your PHP and hosting environment. It may live outside your WordPress directory, and the configuration your website uses may differ from the one used by the PHP command line.

Start by identifying the configuration PHP actually uses. Then determine whether you can edit that file directly. If you can’t access the active configuration file, check whether your hosting provider supports .user.ini, a PHP settings interface, or another per-site configuration method. Advanced File Manager can help you create and edit accessible configuration files from your WordPress dashboard.

Frequently Asked Questions

Can I edit php.ini without FTP or cPanel?

Yes. Depending on your hosting setup, you may use SSH, a WordPress file manager, .user.ini, or your hosting provider’s PHP settings tools.

Can I create a php.ini file in WordPress?

You can create one, but PHP will not automatically use it just because it exists in your WordPress directory. The active PHP configuration determines which files PHP loads.

Can a WordPress plugin edit php.ini?

A plugin can edit configuration files that WordPress can access, but it cannot automatically access a server-level php.ini that your hosting provider restricts.

What if I can’t find php.ini?

Use php –ini, phpinfo(), or php_ini_loaded_file() to identify the configuration PHP actually loads. If you cannot access it, ask your hosting provider which configuration options are available.

Why aren’t my php.ini changes working?

You may have edited the wrong configuration file, PHP version, or SAPI. Another server setting may also override the change. Verify the effective PHP value after making changes.

How long do php.ini changes take to apply?

It depends on your server configuration. Changes to server-level php.ini files may require reloading PHP or the web server. Changes made through .user.ini can take up to five minutes to apply by default, depending on the configured cache time.

Scroll to Top