Summarize this article with:
Your WordPress site just hit a memory limit. Or maybe file uploads keep failing.
The fix lives inside one file: php.ini.
Problem is, finding where php.ini is in WordPress depends on your server setup, hosting type, and PHP configuration. Shared hosting hides it in different spots than VPS servers. Local environments like XAMPP and MAMP store it elsewhere entirely.
This guide shows you exactly how to locate your php.ini file. You’ll learn multiple methods, from cPanel file manager to SSH commands to the phpinfo function.
By the end, you’ll know how to find, access, and safely edit your PHP settings on any server type.
What is php.ini and Why Does It Matter for WordPress?

The php.ini file controls how PHP behaves on your server.
Every WordPress site runs on PHP. This configuration file sets the rules.
Memory limits, upload sizes, execution times. All defined here.
Without access to php.ini, you’re stuck with default server settings. Sometimes those defaults work fine. Often they don’t.
Core Functions of php.ini
Think of it as PHP’s control panel. It determines memory allocation, file upload limits, and error display settings.
Your WordPress site inherits these values automatically.
When WordPress Needs php.ini Changes
Uploading large media files? You’ll hit the default upload limit fast.
Running complex plugins? Memory exhaustion crashes happen. The WordPress memory exhausted error is common when php.ini values are too low.
Installing themes with big demo content? Timeout errors kill the import process.
Why You Need to Locate Your php.ini File
Default PHP settings rarely match WordPress requirements.
Most shared hosting accounts ship with conservative limits. 32MB memory. 2MB upload size. 30 second execution time.
WordPress itself recommends at least 128MB for memory. Premium themes want 256MB or more.
Common Issues Solved by php.ini Edits
- Memory limit errors during plugin activation
- Failed media uploads (images, videos, PDFs)
- Theme demo imports timing out
- White screen issues from exhausted resources
- Max input vars errors with complex forms
When you see a critical error on your WordPress site, php.ini settings are often the culprit.
The Hosting Factor
Your hosting type determines access level. Shared hosting? Limited options. VPS or dedicated? Full control.
Some hosts block php.ini edits entirely. Others provide GUI panels instead.
Default php.ini Locations by Server Type
The file location depends on your operating system and server configuration.
There’s no single answer. Your setup determines the path.
Linux Servers (Most Common)
Apache with modphp typically stores it at /etc/php/[version]/apache2/php.ini
PHP-FPM uses /etc/php/[version]/fpm/php.ini instead.
Command line PHP has its own copy at /etc/php/[version]/cli/php.ini
Windows Servers
Usually found in C:phpphp.ini or within the PHP installation directory.
IIS configurations sometimes place it elsewhere. Check your PHP handler settings.
Local Development Environments
- XAMPP:
C:xamppphpphp.ini - MAMP:
/Applications/MAMP/bin/php/[version]/conf/php.ini - WAMP:
C:wamp64binphp[version]php.ini - Local by Flywheel: Uses site-specific conf files
Finding php.ini Through Your Hosting Control Panel
Most WordPress users access their server through cPanel, Plesk, or similar panels.
The hosting control panel often provides PHP configuration tools without touching the actual file.
cPanel Method
Look for “Select PHP Version” or “MultiPHP INI Editor” in your cPanel dashboard.
The MultiPHP INI Editor lets you change common values through dropdown menus. No file editing required.
For direct file access, use cPanel file manager to browse your root directory.
Plesk Method
Navigate to PHP Settings under your domain. Plesk shows current values with edit options.
DirectAdmin works similarly. Find PHP configuration in your domain settings.
Host-Specific Locations
Bluehost, SiteGround, and HostGator all use cPanel variants. The path looks the same.
WP Engine and Cloudways handle things differently. These managed hosts restrict direct php.ini access but offer dashboard controls.
GoDaddy provides PHP settings through their custom panel after you install WordPress on GoDaddy.
Using phpinfo() to Find Your Exact php.ini Path
Not sure where your server stores php.ini? The phpinfo function reveals everything.
This built-in PHP function displays your complete server configuration. Including the exact file path.
Creating a phpinfo File
Create a new file called info.php in your WordPress root directory.
Add this single line of code:
“ <?php phpinfo(); ?> `
Upload via FTP client or file manager. Then visit yourdomain.com/info.php in your browser.
Reading the Results
Search for “Loaded Configuration File” on the page. That’s your active php.ini location.
You’ll also see “Scan this dir for additional .ini files” which shows where custom configurations load from.
The Configuration File Path shows the default location. Loaded Configuration File shows what’s actually being used.
Important Security Note
Delete info.php immediately after checking. This file exposes your entire server configuration.
Leaving it public creates serious security vulnerabilities. Anyone can see your PHP version, modules, and server paths.
When phpinfo Shows No Loaded File
Sometimes “Loaded Configuration File” displays “(none)” instead of a path.
This means PHP is using compiled defaults. No php.ini file exists yet, or the server can’t find it.
You may need to create one manually in the expected directory.
Accessing php.ini via FTP or SFTP
FTP clients give you direct server access when control panels fall short.
FileZilla, Cyberduck, WinSCP. Any of these work.
Connecting to Your Server
Grab your FTP credentials from your hosting dashboard. Host, username, password, port (usually 21 for FTP, 22 for SFTP).
SFTP is more secure. Use it when available.
Navigating to php.ini
Start in your root directory or publichtml folder.
On shared hosting, php.ini often lives one level above publichtml. Sometimes it’s inside your home directory.
Can’t find it? The file might be hidden. Enable “show hidden files” in your FTP client settings.
File Permissions Check
Found the file but can’t edit? Fix WordPress permissions first.
php.ini typically needs 644 permissions. Owner can read/write, everyone else can only read.
Finding php.ini Through SSH Access
SSH gives you command line access to your web server. Faster than FTP for quick lookups.
Quick Location Commands
Run php –ini to see all loaded configuration files instantly.
Or use php -i | grep “Loaded Configuration” for just the main php.ini path.
The locate php.ini command searches your entire server. Multiple results mean multiple PHP versions installed.
When SSH Isn’t Available
Shared hosting rarely offers SSH. VPS and dedicated servers usually do.
Check your hosting plan or contact support to enable terminal access.
Creating a Custom php.ini File for WordPress
No php.ini exists? Create your own. Many shared hosts allow custom configurations in your WordPress directory.
Where to Place Custom php.ini
Try your WordPress root first (same folder as wp-config.php). Some servers scan here automatically.
Doesn’t work? Try the publichtml folder or your home directory instead.
Basic php.ini Template
` memorylimit = 256M uploadmaxfilesize = 64M postmaxsize = 64M maxexecutiontime = 300 maxinputvars = 3000 `
Start with these values. Adjust based on your needs.
Testing Your Custom File
Create another phpinfo file after adding your custom php.ini.
Check if “Loaded Configuration File” shows your new path. If not, your host might not allow custom configs in that location.
Editing php.ini Safely
One wrong character crashes your entire site. Back up first. Always.
Before You Edit
Download a copy of the original file. Save it somewhere safe.
Make changes during low-traffic hours. If something breaks, fewer visitors affected.
Common Syntax Rules
- Comments start with semicolons (;)
- Directives use format: directivename = value
- No quotes around numeric values
- Memory values use M for megabytes, G for gigabytes
After Making Changes
Restart Apache or PHP-FPM for changes to take effect. On shared hosting, this happens automatically.
Verify with phpinfo(). Your new values should appear immediately.
Key PHP Settings Every WordPress Site Needs
Not all PHP settings matter equally. Focus on these first.
Memory and Upload Limits
- memorylimit: 256M minimum for most sites, 512M for WooCommerce
- uploadmaxfilesize: 64M handles most media files
- postmaxsize: Should equal or exceed uploadmaxfilesize
When uploads fail, check these values first. The 413 error appears when files exceed these limits.
Execution and Input Settings
- maxexecutiontime: 300 seconds prevents import timeouts
- maxinputtime: 300 seconds for form processing
- maxinputvars: 3000 or higher for complex themes
Error Handling
Set displayerrors to Off in production. On for debugging only.
Use WordPress error log instead of displaying errors publicly. Safer and more useful for troubleshooting.
Alternative Methods When php.ini Is Inaccessible
Locked out of php.ini? WordPress offers workarounds.
Using wp-config.php
Add this line to increase memory: define(‘WPMEMORYLIMIT’, ‘256M’);
Place it before “That’s all, stop editing!” in your wp-config.php file. This only affects WordPress, not PHP globally.
Learning how to edit functions.php in WordPress helps for theme-specific adjustments.
Using .htaccess
Apache servers accept PHP values in .htaccess files:
` phpvalue memorylimit 256M phpvalue uploadmaxfilesize 64M phpvalue postmaxsize 64M phpvalue maxexecutiontime 300 `
This method fails on Nginx servers and some PHP-FPM configurations.
Using .user.ini
Create a .user.ini file in your WordPress root. Same syntax as php.ini.
Works on PHP-FPM setups where .htaccess methods fail. Changes take 5 minutes to apply (PHP caches these files).
Troubleshooting php.ini Issues
Changed settings but nothing happened? Common problem.
Changes Not Taking Effect
Wrong file location is the usual culprit. Verify with phpinfo() that your edited file is actually loading.
Some hosts cache PHP settings. Wait 5-10 minutes or restart PHP if you have access.
Site Crashes After Editing
Syntax error somewhere. Restore your backup immediately.
Check for typos, missing values, or incorrect directive names. The WordPress white screen of death often follows php.ini mistakes.
Host Overrides Your Settings
Shared hosts sometimes enforce maximum limits. Your 512M memory request might get capped at 256M.
Contact support to confirm what’s allowed. Upgrade your plan if limits are too restrictive.
Managed WordPress Hosting Differences
WP Engine, Kinsta, Flywheel. These platforms handle PHP differently.
No Direct php.ini Access
Managed hosts lock down server files for security and performance. You won’t find a php.ini to edit.
They optimize PHP settings automatically based on your plan tier.
Dashboard Controls Instead
Most managed hosts offer PHP version switching through their dashboard. Some expose common settings like memory limits.
Need specific changes? Contact their support team. They’ll adjust server-side settings for you.
When to Consider Switching
Constantly hitting limits? Managed hosting might be too restrictive for your project.
VPS solutions like Cloudways give full php.ini access while still handling server management. Best of both worlds for demanding sites.
PHP Version Considerations
Different PHP versions use different php.ini files. This catches people off guard.
Multiple php.ini Files
PHP 7.4 and PHP 8.2 each have separate configuration files. Editing the wrong one changes nothing.
Always confirm which PHP version your WordPress site uses first. Then locate that version’s specific php.ini.
Switching PHP Versions
Changing versions through cPanel? Your settings might reset to defaults.
Document your custom php.ini values before switching. Reapply them to the new version’s configuration file afterward.
If you encounter issues after switching, the 500 internal server error page covers common fixes.
FAQ on Where Is Php.Ini In WordPress
Where is php.ini located on shared hosting?
On shared hosting, php.ini typically sits in your home directory or one level above publichtml. Check your cPanel file manager first. Some hosts like Bluehost and HostGator place it in /etc/php/ but restrict direct access.
Can I create my own php.ini file for WordPress?
Yes. Create a custom php.ini in your WordPress root directory (same folder as wp-config.php). Add your desired PHP settings and save. Some servers scan this location automatically. Test with phpinfo() to confirm it loads.
Why can’t I find php.ini on my server?
The file might be hidden or doesn’t exist yet. Enable “show hidden files” in your FTP client. On managed hosts like WP Engine, php.ini access is blocked entirely. Use the phpinfo function to reveal the exact path.
How do I check my current php.ini location?
Create a file called info.php containing in your root directory. Open it in your browser and search for "Loaded Configuration File." Delete this file immediately after checking for security.
What’s the difference between php.ini and .htaccess for PHP settings?
php.ini controls server-wide PHP configuration. The .htaccess file only works on Apache servers and affects directory-level settings. Use .htaccess when php.ini is inaccessible. Nginx servers ignore .htaccess files completely.
Does WordPress have its own php.ini file?
No. WordPress doesn’t include a php.ini file by default. It inherits PHP settings from your server configuration. You can override some values through wp-config.php using the WPMEMORYLIMIT constant for memory allocation.
How do I edit php.ini without breaking my site?
Always backup the original file first. Make changes during low-traffic hours. Use correct syntax with no quotes around numeric values. Restart Apache or PHP-FPM after editing. Verify changes with phpinfo() immediately.
What PHP settings should I change for WordPress?
Focus on memorylimit (256M minimum), uploadmaxfilesize (64M), postmaxsize (64M), and maxexecutiontime (300 seconds). These values prevent upload failures, timeout errors, and memory exhaustion during plugin or theme operations.
Why do my php.ini changes not take effect?
You likely edited the wrong php.ini file. Multiple PHP versions have separate configuration files. Your host might also enforce maximum limits that override your settings. Verify with phpinfo() which file actually loads.
Can I access php.ini through WordPress admin?
No. WordPress admin doesn’t provide php.ini access. You need server-level access through cPanel, FTP, or SSH. Some hosting control panels offer PHP configuration tools that modify these settings without direct file editing.
Conclusion
Finding where php.ini is in WordPress comes down to your server environment. Shared hosting, VPS, local setups. Each stores the file differently.
The phpinfo() method works every time. Quick, reliable, shows you the exact loaded configuration path.
When direct access isn’t possible, alternatives exist. Use wp-config.php for memory limits. Try .htaccess on Apache servers. Create a .user.ini file for PHP-FPM setups.
Always backup before editing. One syntax error takes down your entire site.
Start with the key directives: memorylimit, uploadmaxfilesize, postmaxsize, maxexecutiontime. These solve most WordPress performance issues.
Now you know where to look and what to change. Your server configuration is no longer a mystery.
