December 23, 2024
PHP info

One of the earlier posts showed how to setup XAMPP on Linux Mint/Ubuntu system.

This is great for setting a test web setup but instead of relying on a single XAMPP package, each of the individual components can also be installed separately namely Apache, MySQL and PHP.

This is especially applicable when building an Ubuntu server as a LAMP (Linux, Apache, MySQL, PHP) setup to host websites or web apps.

To setup a LAMP stack on Ubuntu / Linux Mint system :

1. First make sure to get the latest updates for the system by opening Terminal and typing :

sudo apt-get update

2. Next, it is time to setup Apache web server :

sudo apt-get install apache2

3. For setting up MySQL database services :

sudo apt-get install mysql-server

Follow the on-screen instructions and enter a root password during MySQL installation. Then to enable PHP support for MySQL:

sudo apt-get install php5-mysql

4. Finally for setting up PHP :

sudo apt-get install php5 php-pear

At this point, the LAMP server is setup. Simply reload the Apache web server by typing :

sudo service apache2 reload

Enter http://localhost in browser, the following page should come up indicating web server is running :

Apache webserver

Now, to validate that PHP is setup correctly and LAMP server is working as expected, go to the default web server directory (/var/www) and create a file named info.php

sudo nano /var/www/info.php

In it, enter the following PHP code and save the file :

PHP info file

Now, access this by typing http://localhost/info.php

PHP info

This will load the PHP info page displaying the configuration settings and also basically validating that PHP is now being served correctly by the Apache webserver.

All done.

Happy installing!

By admin

Related Post