How To Edit A File In Ubuntu Terminal

broken image


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.

  1. How To Edit A File In Ubuntu Terminal Server
  2. How To Edit A File In Ubuntu Terminal 7

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.

How To Edit A File In Ubuntu Terminal Server

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.ini File Location in Ubuntu

The path of php.ini in Ubuntu is /etc/php5/apache2 . Open the terminal and start typing following commands.

2

To view the files present in apache2 directory, type ls command. The files present in this directory (conf.d and php.ini) are displayed.

If you are not familiar with Linux commands then read my previous post on Linux Commands with Examples .

Editing Configuration Files Through the GUI. Open the Terminal program (CTRL +ALT+T) and open Orchid Core VMS 's configuration file by typing the following command: sudo gedit /etc/opt/orchidserver.properties. Then press Enter.If a different file needs to be edited, such as the Orchid ONVIF auto-discovery configuration file, change the. If you touch a file that doesn't exist, the system creates the file without putting any data inside. For instance, the command: touch myfile.txt. The above command creates a new, empty file called myfile.txt if that file does not already exist. Redirecting text into a file. Sometimes you need to stick the output of a command into a file.

How To Edit A File In Ubuntu Terminal 7

The other easiest way to locate the php.ini file is using locate command.

How to open & edit the php.ini configuration file on a Terminal

To open & edit the php.ini file I am using vim/vi editor.

Read more about Beginners guide for vi/vim editor.

You can directly open this file using the following command.

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.

or

Terminal

PHP Script to Find the Location of php.ini

If you are working on Windows, Ubuntu or any operating system. You can easily find the location 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) .

2
4

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.

Conclusion

I 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.

Related posts:





broken image