We will learn how to install Apache 2 web server with php, MySQL and phpmyadmin on Linux.For this Post i am will be using Ubuntu 12.4 but you can use any linux ditro.
Lets Start.Open up the command terminal in Linux and type “sudo apt-get install update” this will update the repository in ubuntu,After this type this command to install Apache 2 web server”sudo apt-get install apache2″ in the installation it will say do you want to Continue, type “y” to install it.
Next we need to install php5 programming language in ubuntu Linux, Type “sudo apt-get install php5” in the Terminal and press enter to install it.
After this we will Type this command “sudo apt-get install libapache2-mod-php5” to connect with apache 2 web Server.After this we need to install MySQL database, Type this command in the terminal “sudo apt-get install mysql-server” to install MySQL database in ubuntu Linux, after the installation mysql server will ask you for the root password, Type the desire password e.g ubuntusql and press enter after this it will again ask you to retype you password enter the same password and press enter.
After setting up the MySQL server on Ubuntu Linux its time to install phpmyadmin, Type “sudo apt-get install libapache2.mod-auth-mysql php5-mysql phpmyadmin” and press enter, after installation process is over Configuring phpmyadmin window will show up choose apache2 webserver and press enter.
After some Configuration process this window wills show up type your Mysql Database password e.g. “ubuntusql” and press enter.
After this another window will show up in that window type your desire phpmyadmin password e.g “ubuntuphp” and press enter, Type the same password again and press enter.
Now your good to go everything has install in the system properly now we need to create a link in the /var/www directory for easy access to that type this “sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin” in the Terminal and press enter.Now type this command “sudo /etc/init.d/apache2 restart” to restart apache.You can also start or stop apache2 by replacing restart with start or stop.
After that open Firefox or any web browser and type localhost, if you see the following screen that means apache2 server is working properly.
To add web content on this server open up the var/www/ directory and create a html or php web file.
To test php locate the www directory by typing this command in the terminal “cd /var/www” after this type this “sudo touch test.php” to create a new php after that type this “sudo gedit test.php” and press enter, a code editor will open up; type this line of code ““in the test.php file to check if php is working.
Open up the web browse and type localhost/test.php in the url, if you see the following page that means php has properly installed on the system.
Now Type localhost/phpmyadmin in the url to open phpmyadmin.
Enter your Username and password,User name is “root” and the password is ubuntuphp yours will be different and click on go or just press enter. After logging in you will see the following screen.
Now everything is working fine to learn more about myself or php check my other posts.