php.ini is the settings file for PHP on your hosting. It sets limits, such as how much memory a script may use, how big an upload may be and if errors show. The settings in it apply to every page of your site, so they decide how your site behaves.
What is php.ini?
When PHP starts, it reads this file, and the values in it decide how every script on the server behaves.
PHP comes with defaults, and php.ini changes them. A typical file is a long list of lines in the form name = value, with comments on the lines that start with a semicolon. Settings you will meet most often are memory_limit, upload_max_filesize, post_max_size, max_execution_time, display_errors and the location of the error log.
PHP also has more than one place to read settings. There is the main php.ini, extra files in a configuration folder for individual extensions, and for sites running under PHP-FPM a per-folder .user.ini file. A server can also have separate php.ini files for the command line and for the web, which causes a lot of confusion.
Production and development values
PHP ships with sample files for development and production. The development version shows errors on screen, which helps a developer. The production version keeps errors off the screen and in the log, so visitors do not see file paths or code details.
php.ini and your WordPress site
Which PHP version does your site report?
We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login.
WordPress will tell you when a setting is too low. The media library says a file is too big to upload, or an import stops halfway, or a plugin throws a fatal error about memory. In nearly all cases the cause is a value in php.ini, or a host that sets it low.
How you change it depends on your hosting. On managed or shared hosting, you change values in the PHP settings of your hosting control panel. On a VPS you edit the file yourself and reload PHP.
Some hosts let you place a .user.ini file in your site folder.
How to find the file PHP uses
Create a temporary phpinfo page, open it in the browser and look at “Loaded Configuration File” and “Scan this dir for additional .ini files”. Those lines show which files the web version of PHP reads. Remove the page afterwards, because it exposes server details.
Then change one value, reload PHP, reload the phpinfo page and check that the value changed. If it did not, you are editing the wrong file or the host overrides it.
When to act
Look at php.ini when you see upload limits, timeouts or memory errors on your site, and also when you update PHP. A new PHP version often comes with a fresh php.ini, and settings you changed on the old version are not copied by themselves. After a switch, compare the important values.
If a site is down because of a configuration problem and you are not sure where to start, our emergency help for a website down is the quickest route back.
Not sure how this applies to your site?
Ask a person to take a look. We check which PHP version your site runs and whether the fix is in, and tell you the next step.
Or have PHP updated right away: PHP update from $555 excl. VAT
Frequently asked questions
Where is my php.ini file?
It depends on the server. A phpinfo page shows the path next to Loaded Configuration File. On shared hosting you often cannot edit that file directly and change settings through your control panel instead.
Why does my php.ini change have no effect?
Usually you edited a different file than the one your website uses, or PHP was not reloaded. The command line and the web server can read separate files, so check the phpinfo page of the website itself.
What is a .user.ini file?
It is a per-folder settings file that PHP reads when it runs as PHP-FPM or CGI. It lets you change allowed settings for one site without touching the main php.ini.
Is it safe to edit php.ini on a live site?
A wrong value can stop every PHP site on that server. Keep a copy of the original, change one setting at a time and check the site afterwards.