If you are a PHP based web developer, you need all the software running and configured properly. Here I am talking about installing them One by One in your Ubuntu Desktop. We are installing all the applications from terminal.
How to Open Terminal:
So, to fire up the terminal follow any of these steps:
- If you are running Unity Desktop, click on the Ubuntu Logo at top left corner and type Terminal in the search application bar. Then click on the terminal icon.
- If you are running GNome Desktop, click on Applications->Accessories->Terminal
- For shortcut, you can also press Ctrl+Alt+T at once, to open the terminal.
How to install Apache:
1. Make sure you have the internet connection. To install apache execute the following command in the terminal:
sudo apt-get install apache2
It takes some time to download and install apache. After the setup completes, type http://localhost/ in your browser window to make sure apache is installed and running properly. If you see the page with It Works!, the setup of apache2 completes successfully.
How to Install PHP:
1. To install PHP 5, type following commands in the terminal one by one:
sudo apt-get install php5 sudo apt-get install libapache2-mod-php5
The first line installs PHP5 in the computer. The second one provides the PHP5 module for the Apache 2 webserver. If second one is not installed, then Apache cannot parse PHP codes in a web page.
2. After installing PHP5 and PHP module for apache, restart the apache with following code:
sudo /etc/init.d/apache2 restart
3. While restarting the apache server, if you see a warning as “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName”, then you can fix this by creating a file with the Server name. To do this type the following command in the terminal:
sudo gedit /etc/apache2/conf.d/fqdn
When the text editor opens, type “ServerName localhost” inside the file and click Save. Then close it. Now restart again with the above code and you will see that the warning message has gone.
4. Now, we have successfully installed php and apache web server. However, still we don’t know if PHP is successfully installed. To check this, create a file inside /var/www/ folder named test.php as:
sudo gedit /var/www/test.php
and write following code in it
<?php phpinfo(); ?>
Save the file and type this in browser: http://localhost/test.php
If you see the various information about PHP and installed modules there, then we can confirm that Apache is parsing PHP codes. Hence the installation is successful up to this point.
How to Install MySQL:
1. To install MySQL Server in ubuntu, type following code in terminal window:
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
This will install latest mysql server and other necessary PHP modules for recognizing mysql functions from PHP code. While installing MySQL server, you may require to enter the password for MySQL root user.
How to Install PHPMyAdmin:
1. To Install PHPMyAdmin, type the following codes in the terminal:
sudo apt-get install phpmyadmin
While installing PHPMyAdmin, you may require to select the web server. In such case, tick the Apache2 Server and proceed with the installation. You may also require to input MySQL root user password during installation.
Once the installation completes, type this in your browser window to confirm the successful installation of PHPMyAdmin: http://localhost/phpmyadmin/index.php.
Now, you are finished. Your environment is setup and you can enjoy using all these applications. Next, you can install other applications that may be necessary such as Eclipse, GIMP etc.