Website Without PHP
US
Menu

php.ini

Also known as: PHP configuration file

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.

PHP and versions Last updated:

php.ini is the settings file for PHPPHP is a programming language that builds your web pages on the computer that hosts your site, just before they reach the visitor. WordPress runs on it. on your hostingWeb hosting is the service that keeps your website's files on a computer that is always online, so visitors can open your site at any time.. 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_limitmemory_limit is a PHP setting that decides how much memory the code behind one page may use. If it needs more, it stops with an error., upload_max_filesize, post_max_size, max_execution_time, display_errors and the location of the error logAn error log is a file where your website's software writes down what went wrong, with the time and place. It is the first thing to check when a site breaks..

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-FPMPHP-FPM is a helper on your hosting that runs your site's PHP code as a separate job and hands the finished page back to the program that answers visitors. 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

WordPressWordPress is free software for building and editing a website in your browser. It is written in PHP, so it builds each page when someone visits. 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 pluginA WordPress plugin is an add-on you install in WordPress to give your site extra features, such as contact forms, SEO tools or a webshop. 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 hostingShared hosting is a hosting plan where many websites share one computer. It is cheap and simple, but your host decides which PHP versions you can use., you change values in the PHP settings of your hosting control panelA hosting control panel, such as cPanel, Plesk or DirectAdmin, is the web page where you manage your domain, email, databases and PHP version.. On a VPSA VPS (virtual private server) is your own virtual computer inside a bigger shared machine. You get more control than on shared hosting, and more to manage. 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 versionA PHP version is a numbered edition of PHP, like 8.3. Each edition is looked after for a limited time, then gets security fixes only, then nothing. 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.

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 serverA web server is the program, such as Apache, Nginx or LiteSpeed, that answers when a visitor opens your site and sends back the page and files. 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.

Related pages

  1. Domain
  2. Check
  3. Result
  4. Report

Which PHP version does your site run?

Enter your domain. We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login. We keep the domain and the result, never your IP address.