Wednesday, June 20, 2012

Server side installation in Ubuntu

Installation of PHP, MySQL and Apache in Ubuntu


step 1 :  sudo apt-get update
step 2 :  sudo apt-get install php5
step 3 :  sudo apt-get install apache2
step 4 :  sudo apt-get install mysql-server
step 5 :  sudo apt-get install php5-mysql

once the above steps are done we need to check

in ubutu

to check apache server


cd /var/www/

../var/www> ls

index.html
 -------------------
<html><body><h1>It works!</h1>
<p>This is the default web page for this server.</p>
<p>The web server software is running but no content has been added, yet.</p>
</body></html>

Go to web browser and type
localhost/index.html 

to check php 


write a small php script 

firstphpscript.php

<?php
echo "myFirst Php Script";
?>

Go to web browser and type
localhost/firstphpscript.php



to check mysql connection with php


write a small php script for connecting to mySql 

firstphpmysql.php

<?php
ini_set('display_errors', 1);
mysql_connect("localhost", "root", "jithu") or die(mysql_error());
echo "Connected to MySQL<br />";
?>

Go to web browser and type
localhost/firstphpmysql.php


Thats the end of checking the working of apache, php and mysql

Next blog we will write small application !!


No comments:

Post a Comment