If you are trying to change a PHP setting for WordPress, you may be wondering, “Where is the WordPress php.ini file?” The short answer is that there usually is no php.ini file inside WordPress itself. WordPress runs on PHP, and the PHP configuration file is managed by your web server or hosting provider. Its location depends on your hosting setup, PHP version, and how PHP is running.
That distinction matters: editing the wrong php.ini may have no effect on your website. This guide explains where to look, how to identify the configuration file used by your site, and what to try if you cannot edit it. It also covers safer alternatives for changing PHP settings on shared hosting, managed WordPress hosting, and your own server.
Where Is the WordPress php.ini File?
The php.ini file is a PHP configuration file, not a WordPress core file. You will not normally find it alongside WordPress files such as wp-config.php, wp-content, or wp-includes. Instead, the active file is located in a PHP or server configuration directory chosen by the hosting environment.
Common locations on Linux servers include paths such as /etc/php/8.2/apache2/php.ini, /etc/php/8.2/fpm/php.ini, or /etc/php.ini. The exact path varies by operating system, PHP version, and server software. On Windows servers, the file might be in the PHP installation directory.
Some hosting accounts also allow a per-site or per-directory configuration file. In that case, the file may be in your hosting account’s home directory, the website’s document root, or a folder containing your WordPress installation. A local file can override some settings without changing the server-wide php.ini.
Why the php.ini Location Varies
A server can have more than one PHP configuration file. For example, the command-line version of PHP may use a different configuration from the PHP version serving your website. A server may also have separate settings for different PHP versions or different ways of running PHP, such as Apache PHP or PHP-FPM.
This means a php.ini path found in a tutorial, a control panel, or your server’s command line may not be the file that controls WordPress. The important question is not just where a php.ini file exists, but which configuration PHP actually loads for your website.
- PHP version: Each installed PHP version may have its own configuration.
- Web server setup: Apache, PHP-FPM, and other configurations can load different files.
- Hosting plan: Shared and managed WordPress hosts may restrict access to server-level files.
- Directory overrides: A local configuration file may change settings for one site or folder.
How to Find the Active php.ini File
The most reliable way to find the active configuration is to check the PHP environment that runs your website. If you have server access, ask your hosting provider for the PHP configuration path used by your domain. They can confirm the active file and tell you whether you are allowed to edit it.
On a server where you can use a terminal, the command php --ini displays the configuration used by the command-line PHP executable. You can also run php -i and look for the “Loaded Configuration File” entry. Remember that these commands may show the CLI configuration, which can differ from the one used by your WordPress website.
For a web-based check, a temporary PHP information file can display the configuration loaded by the website. Create a file with a name such as php-info.php in the site’s document root and add:
<?php phpinfo(); ?>
Visit that file in your browser and look for “Loaded Configuration File.” The page also displays many server details, so do not leave it publicly accessible. Delete it as soon as you have finished checking. If you cannot create files or do not have permission, contact your host instead.
Some hosting dashboards show the active PHP version and settings without revealing the full file path. WordPress Site Health can also help you review information about the PHP environment, but the details available depend on your WordPress version and hosting setup. If the exact loaded configuration file is not shown, your hosting provider can identify it.
Where to Look in Your Hosting Account
Before searching through server folders, check your hosting control panel. Many providers offer a PHP settings page that lets you change common options without directly editing php.ini.
- cPanel: Look for “MultiPHP INI Editor,” “Select PHP Version,” or a similar PHP settings tool. The labels vary by provider.
- Plesk: Open the domain’s PHP settings page to review supported options and values.
- Managed WordPress hosting: Check the host’s dashboard or documentation. Some managed providers handle PHP settings for you and do not provide file-level access.
- Virtual private server or dedicated server: Check the PHP configuration directories for the version and PHP service used by the site.
On shared hosting, you may find a custom php.ini in your account’s home directory or website folder. The hosting provider determines which locations PHP scans, so a file in the wrong folder may be ignored. If you see multiple php.ini files, do not assume that editing any one of them will update your WordPress site.
Can You Put php.ini in the WordPress Root?
You can sometimes place a local php.ini file in the WordPress root directory, but whether it works depends on the host’s PHP configuration. The WordPress root is the folder containing files such as wp-config.php and wp-login.php. Some servers read a local php.ini there; others ignore it or require a different location.
Do not create or replace a php.ini file based on a generic tutorial without checking your host’s instructions. A local file may need only the settings you want to change, while a server-wide file can contain many important defaults. Incorrect configuration can cause errors or make the site behave unexpectedly.
Using .user.ini as an Alternative
Some PHP-FPM and CGI-based hosting environments support a .user.ini file for per-directory settings. It is often placed in the website’s document root or another directory specified by the host. PHP checks for this file according to the server’s configuration, and changes may take several minutes to take effect because results can be cached.
A .user.ini file is not a universal replacement for php.ini. Only certain settings can be changed this way, and some hosts disable the feature. Ask your provider which directives are permitted and where the file should go before using it.
What About .htaccess?
Some older instructions recommend adding PHP directives to .htaccess. This works only on particular Apache configurations and for directives the server allows in that file. It generally is not the right method for PHP-FPM setups, and unsupported directives can cause an “Internal Server Error” or a 500 error.
Before changing .htaccess, make a backup and confirm that your hosting provider supports the directive you plan to use. If the website becomes unavailable, restore the backup using your hosting file manager or FTP access. When in doubt, use the hosting panel or ask the host to make the change.
Common PHP Settings WordPress Users Change
People often look for php.ini when they need to increase a limit or fix an installation issue. Examples include the maximum upload size, maximum execution time, memory limit, and maximum input variables. The appropriate values depend on the website’s needs and the host’s limits. Increasing a value beyond the provider’s allowed maximum may have no effect.
-
upload_max_filesize: Limits the size of an individual uploaded file. -
post_max_size: Limits the size of the full POST request and should generally be at least as large as the upload limit. -
memory_limit: Sets the PHP memory available to a script, subject to hosting restrictions. -
max_execution_time: Sets how long a PHP script may run before timing out. -
max_input_vars: Limits the number of input variables PHP accepts in a request.
Changing a PHP setting does not always solve the underlying issue. A failed upload, for example, could also be caused by a WordPress plugin, a browser timeout, or an application-level restriction. Check the exact error message and the limits reported by your hosting account before making changes.
Can You Change PHP Settings in wp-config.php?
wp-config.php is WordPress’s main configuration file, but it is not a replacement for php.ini. It can define certain WordPress-specific constants, including some related to memory, but those values do not override every PHP setting. The web host may also enforce a limit that WordPress cannot increase.
If you edit wp-config.php, save a backup first and use the method recommended by your host. Avoid adding random PHP directives to this file: directives belong in a supported PHP configuration location, not in WordPress configuration code.
What to Do If You Cannot Find or Edit php.ini
Many WordPress users do not have direct access to the server’s php.ini file, especially on shared or managed hosting. This is normal. Use the tools your host provides, or contact support with the setting you need to change and the reason for the change.
- Check your hosting dashboard for PHP, MultiPHP, or domain settings.
- Read your provider’s instructions for local php.ini or
.user.inifiles. - Confirm that the setting is supported and ask whether there is a maximum value.
- Ask support to make the change if your plan does not allow direct editing.
- Recheck the value after the change using the dashboard or a safe diagnostic method.
For a production website, avoid leaving diagnostic files online and do not edit server configuration files unless you understand their scope. If you manage your own server, back up the existing configuration and restart or reload the relevant PHP service when required. Follow the server’s documentation, since the correct service command varies.
Frequently Asked Questions
Is php.ini inside the WordPress folder? Usually not. WordPress itself does not include a standard php.ini file. Your host may allow a local configuration file in or near the website directory, but the correct location depends on the server.
Why does editing php.ini make no difference? You may have changed the wrong file, PHP may use a different configuration for the website, or the host may block that setting. Check the active configuration and ask your hosting provider to confirm how overrides work.
Does every WordPress website have a php.ini file? Every PHP environment uses configuration settings, but the active configuration may be maintained by the server and inaccessible to the site owner. Some hosting environments use per-directory overrides instead of a php.ini file in the WordPress folder.
Will a php.ini change take effect immediately? Not always. Some server setups require a PHP service reload, and local configuration changes may be cached for a period of time. Your host can tell you how long changes take to apply.
Conclusion
The WordPress php.ini file is not normally part of the WordPress installation. Its location depends on your server, PHP version, hosting plan, and PHP handler. To find the active file, check your hosting panel, use a server command where appropriate, or ask your provider to confirm which configuration controls your website.
If you cannot access php.ini, look for supported alternatives such as a hosting control panel or a permitted .user.ini file. Make changes carefully, verify that they took effect, and remove any temporary diagnostic files. Knowing which PHP configuration your WordPress site actually uses is the key to changing settings safely and effectively.