How To Run PHP Code In Local Computer


Step by Step Instructions to Run PHP Code in Localhost

 

NOTE  : This tutorial is for Windows

 

Running a php code in your local computer is very simple. You will need a Web Server like Apache and PHP. If you want to run some database related code like login validation, and other database related tasks, you need a database server like MySQL.

You can install all of them individually, but a single product like WAMP Server will make everything easy. WAMP stands for Windows Apache MySQL and PHP. Installing and running WAMP Server is very easy when compared to others. And you don't need to configure hard stuff. Just follow the procedure.

 

Installin WAMP Server to run PHP:

  1. Goto www.wampserver.com and download WAMP Server.
     
  2. Just install it like other softwares by just clicking next next...
     
  3. Now go to START menu of windows and start wampserver.
    Generally, the path is Start -> WapmServer -> start WampServer
     
  4. Open your web browser and type http://localhost (or http://127.0.0.1
    If you see a default WampServer home page, you installation is success.
     
  5. Now put your php code in www folder in your wamp installation directory.
    Usually this is C:\wamp\www
     
  6. Now type http://localhost/filename.php in your browser.   (where filename is your php file name)
     
    It will execute your php code.. Thats it...
     

 


Comments

i want connect php page with mysql through wampserver.
pls tell me the process
i know how create the table in mysql.
but i dont know how it connect with php

thanks

i want connect php page with mysql through wampserver.
pls tell me the process
i know how create the table in mysql.
but i dont know how it connect with php

pls tell me the code and the process to write that will bring the form confirmation page for me,after the submition of a form

If You had create a table..
then simply create a connection b/w php page and Mysql server...
like:
$dbserver="localhost";
$username="root";
$password="root"; // if it is exist in your database other wise it will be null($password="")
$connection=mysql_connect("$dbserver","$username","$password")or die("could not connect to the server");
mysql_select_db("$dtatabasename", $connection);
$str="insert into table_name(coloumn1,coloumn2....)values('value1','value2'...);
$sql=mysql_query($str);
echo "record saved";
?>

thanks mate ;)

u r wecome

i have tried to delete and install a new one but nothing happens

Good dude .... it's working

Thanks for putting in step by step order, which is very handy and easy to follow to get the local site working...

It is still depends on users perspective to choose which hosting plan that provide the best value for them.
One of the many assumptions that has since become fact
is that customers simply do not use all the bandwidth (storage) that they've been allotted in their paid plan.
People who are new to webbing hosting are definitely recommended in going with
a reseller hosting account because of the truth that it's much easier to keep sites organized.

Also visit my site: Php mysql Web Hosting

thank uuuu its very helpful for now @ this time dude...

I've done more process but I can't get this.
Now it is really Helpful Thank's a lot...........

$dbserver="localhost";
$username="root";
$password="root"; // if it is exist in your database other wise it will be null($password="")
$connection=mysql_connect("$dbserver","$username","$password")or die("could not connect to the server");
mysql_select_db("$dtatabasename", $connection);
$str="insert into table_name(coloumn1,coloumn2....)values('value1','value2'...);
$sql=mysql_query($str);
echo "record saved";
?>

I also try this. Is easy to type but it hard to learn.

instead of $databasename it would be simply databasename

thanks

it is very helpful 2 me..thnkz alot

pls don't disturbe me to write afake code!

Wow!! This is the post just what I was looking for and finally found here. Its my real pleasure that I've come to know through reading your post that how to run PHP code on a local computer. keep up the good work with more information :)

server hosting

thank u..

I also try this. It is easy to type but it hard to learn.
Thank you for the process :)

hey when i start localhost there is always blank page.plz help me

vchtr

i have tried lot of coming error my sql conncetion manual check near

how to use text boxes in php like in vb.net

i need code for update can you help me?

Please help me.
how to create a folder on wamp server using php?

Hi,
their is problem to open http://localhost/testing.php
and also I dont know where to write php code and How to create database using mysql in WAMP server.
Please guide me for this.
Thanks in advance.

Hi,
their is problem to open http://localhost/testing.php
and also I dont know where to write php code and How to create database using mysql in WAMP server.
Please guide me for this.
Thanks in advance.

Worked like a charm!