The php.ini file is a default configuration file that read on PHP starts up. The PHP settings and configuration can be modified by the php.ini file. Show
If you want to change the PHP settings on Ubuntu,
In this tutorial, we are going to see how to edit PHP ini file in ubuntu terminal. php.ini file is a default configuration file that is read when PHP is started. PHP settings and configurations can be changed through php.ini. If you want to change PHP configurations on Ubuntu, the php.ini file is a simple and effective way. Follow the steps below to modify the PHP configuration file (php.ini) on the terminal in Ubuntu. sudo nano /etc/php5/apache2/php.ini 2. Change PHP parameters. For example, if you want to increase the execution time, increase the value of the variable max_execution_time in seconds. max_execution_time = 60 3. Once you have changed the configuration values, save and exit the editor. sudo service apache2 restart 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. The 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. If 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) . 1 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 1 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. How do I open php ini in Ubuntu terminal?To open php. ini file in Linux terminal and just use vim or vi command. For example : vim /etc/php. ini.
Where is the php ini file located?ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.
How to change php settings in Ubuntu?How to Modify the PHP Configuration File on Ubuntu. Open the terminal and run the following command to open the php. ini file. ... . Change the PHP settings. ... . Once you modified the PHP configuration values as per your needs, save changes and exit editor.. Now restart the web server to enable the changes you have done.. How to edit the php ini file?Modifying the PHP.. Login to the cPanel.. Find the File Manager in File section of the cPanel. ... . Navigate to the directory where you will either save or edit the PHP. ... . Edit the section of the PHP. ... . Click on SAVE CHANGES in the top right hand corner in order to save your modifications or additions to the file.. |