The php.ini is a configuration file which is read when PHP starts up. This file contains various settings that control the behavior of PHP. The location of the php.ini file depends on operating system, server configuration, PHP version, and other factors.
This tutorial shows how to find the location of the php.ini configuration file.
In most cases there are different php.ini files that are used for web server (Apache, Nginx, etc.) and PHP CLI (Command Line Interface).
Web server
To determine which php.ini file is used for web server, create a PHP file in the document root and add the following code:
php_info.php
<?php
phpinfo();
The phpinfo function prints information about configuration of the PHP. Open a web browser and search for text "Loaded Configuration File" on a page.
On Linux system, the location of the php.ini file for Apache web server can be something like:
/etc/php/8.0/apache2/php.ini
PHP CLI
To find out which php.ini file is used for PHP CLI, run the php command with -i or --info option:
php -i
It will call the phpinfo function and print results. To find the required line, we can use grep command on Linux:
php -i | grep "Loaded Configuration File"
Or findstr command on Windows:
php -i | findstr /c:"Loaded Configuration File"
On Linux system, we will get the output similar to:
Loaded Configuration File => /etc/php/8.0/cli/php.ini
The 2 Comments Found
can't create webP image because php GD is a problem
Hi, harga mobil
PHP GD extension supports various image formats such as PNG, JPEG, GIF, WebP, etc. GD extension should be enabled in
php.inifile in order to useimagecreatefromwebpfunction.Leave a Comment
Cancel reply