In my previous post, Installing LAMP Stack on Ubuntu and Debian in Just 3 Steps, you’ve learned how to install LAMP Stack on Ubuntu.
In this post we’ll:
The directory pointed by localhost is the root directory. This is the directory where we put our website and then tells browser to show the required file by typing in the address bar.
In Ubuntu the root directory is /var/www/html/. Whenever we’ll type localhost (which is equal to localhost/index.html or localhost/index.php, that’s why we don’t type index.html or index.php) in the browser’s address bar, as we did in the previous post, the server will look for the index.html or index.php in the root directory (/var/www/html/) and will present index.html as shown as below:
If you want, you can create other directories, subdirectories and so on and files in the root directory, but in this case you’ll have to mention the directory name and file name after the localhost such as localhost/directory/subdirectory/file.php. For example: if you put a directory named ‘mysite’ in the root directory then you’ll have to type localhost/mysite/index.php (you may also type only localhost/mystie) in the address bar of the browser.
Now, you know what the root directory is, we’ll create a phpinfo.php file in our root directory. Follow the steps given below:
sudo gedit /var/www/html/phpinfo.php
the above command will create a file in /var/www/ html/and open it in gedit (if you don’t have gedit installed, replace the word gedit with nano). Type the following code in the phpinfo.php file:
<?php phpinfo(); ?>
Save the file and in the address bar of your browser type http://localhost/phpinfo.php hit enter and you should see the following page in your browser:
PHP Extension Modules are the extensions for PHP to enhance the performance of the language. You can easily add or remove these extension modules according to your needs.
Run the following command in your terminal to a PHP Module Extension.
sudo apt-get install php5-extension_name
Your may see the extensions name by the method given below. Look for your desired extension name and replace in the above command with extension_name. For example to install mysql extension run the following command:
sudo apt-get install php5-mysql
Run the following command in your terminal to see the available PHP Extension Modules.
apt-cache search php5-
Run the following command in your terminal to see the the specifications and the dependency, that particular extension to others extension, PHP Module Extensions.
apt-cache show extension_name
In this post we learn: