Alternatively execute the following command to locate the loaded php --ini | grep Loaded Loaded Configuration File: /etc/php/7.3/cli/php.ini3 command: Show php --ini | grep Loaded Loaded Configuration File: /etc/php/7.3/cli/php.ini Please, note that the above php --ini | grep Loaded Loaded Configuration File: /etc/php/7.3/cli/php.ini3command. For the Apache web-server the above path will translate to: What is the php.ini file, why we use it ? Where do I find this file on Ubuntu ? How I open and edit the php.ini file on a terminal. This is the most common questions asked by beginners who are either new to PHP or Linux. php.ini FileThe php.ini file is a default configuration file used when your PHP application runs. When PHP starts it reads the configuration setting from the php.ini file. If you have installed LAMP on a Ubuntu operating system and unable to find and edit this file then this tutorial is for you. PHP Script to Find php.ini LocationIf you are working on Windows, Ubuntu or any operating system. You can easily find the location of php.ini configuration file using simple PHP script. Create a PHP file. Let’s name it inipath.php (you can choose any name with a .php extension) . Java1 2 3 4 5 <?php
phpinfo();
?> Open this file in your browser and you will get the path of the php.ini. I am using Ubuntu and the location of php.ini in Ubuntu is /etc/php5/apache2/php.ini . Similarly, if you are running this script on Windows and Mac you’ll get the path as per their directory structure. For version 7.4.3, the php.ini path is /etc/php/7.4/apache2/php.ini. php.ini File Location in UbuntuFor PHP5 The path of php.ini in Ubuntu is /etc/php5/apache2 . Open the terminal and start typing following commands. Java1 2 3 $ cd /etc/php5/apache2
$ ls To view the files present in apache2 directory, type ls command. The files present in this directory (conf.d and php.ini) are displayed. For PHP 7.4 version The path of php.ini is Java1 2 3 $ cd /etc/php/7.4/apache2
$ ls If you are not familiar with Linux commands then read my previous post on Linux Commands with Examples . The other easiest way to locate the php.ini location is using locate command. Java1 $ locate php.ini How to open & edit the php.ini configuration file on a TerminalTo open & edit the php.ini file I am using vim/vi editor. Read more about Beginners guide for vi/vim editor. 1 $ sudo vim php.ini You can directly open this file using the following command. Java1 $ sudo vim /etc/php5/apache2/php.ini NOTE – Once you have done the changes in the php.ini file. You need to restart the apache web server so that the new changes get reflected. To restart the Apache WebServer. 1 $ sudo /etc/init.d/apache2 restart or Java1 $ sudo service apache2 restart Popular PHP ArticlesAbstract vs Interface in PHP Abstract class in PHP Programming Videos Tutorial ConclusionI hope this tutorial helped you to find and edit the php.ini file. If you are still facing any issue you can ask your question through comments. Where is my PHP ini file in Ubuntu?The default location for the php. ini file is: Ubuntu 16.04: /etc/php/7.0/apache2. CentOS 7: /etc/php.
How do I find PHP ini on Linux?If you can access one of your PHP files, open it in a editor (Notepad) and insert phpinfo(); after <? php on a new line. This will tell you the php. ini location.
Where is the PHP config file located?The PHP configuration file allows you to configure the modules enabled, the email settings or the size of the upload files. It is located at /opt/bitnami/php/etc/php.
|