Posted By:
4 Feb, 2014 2:47 am PST

CREATING & RUNNING YOUR FIRST PHP PROGRAM

   

CREATING & RUNNING A PHP FILE

 

YOU ARE ON YOUR DESKTOP SCREEN

 

image1

 

FOR LINUX USERS

[1] OPEN COMPUTER:-

 

image2

 

[2] OPEN FILE SYSTEM:-

 

image3

 

[3] OPEN VAR:-

 

image4

 

[4]OPEN WWW:-

 

image5

 

[5] OPEN HTML:-

 

image6

 

FOR WINDOWS USER :-

OPEN THE FOLDERS IN FOLLOWING ORDER:-

MY COMPUTER=> C:=> WAMP=> WWW

TIP:- FOR RUNNING PHP SCRIPTS IN WINDOWS YOU NEED TO INSTALL WAMP SERVER.

[6]OPEN TEXT EDITOR:-

 

image7

 

START TYPING YOUR PHP CODE HERE.

TYPE THE FOLLOWING CODE TO GET INFORMATION OF PHP SERVER ON YOUR COMPUTER:-

 

<html>

<head>

<title>PHP Test</title>

</head>

<body>

<p>This is an HTML line

<?php

echo “<p>This is a PHP line</p>”;

phpinfo();

?>

</body>

</html>

 

 

[7] SAVE THIS PHP SCRIPT IN THE LOCATIONS AS DESCRIBED ABOVE:- I.E.

FOR LINUX:- FILE SYSTEM=> VAR => WWW => HTML

FOR WINDOWS:- MY COMPUTER=> C:=> WAMP=> WWW

ALWAYS AVE YOUR FILE WITH EXTENSION“FILENAME.php

image8

 

[8]OPEN A WEB BROWSER:-

[9] TYPE THE FOLLOWING ADDRESS IN ADDRESS BAR:-

http://localhost/

[10] TO RUN YOUR PROGRAM TYPE THE FOLLOWING ADDRESS IN THE ADDRESS BAR

http://localhost/program name.php

FOR INSTANCE THE PROGRAM IS SAVED AS First program.php ” HERE

SO THE ADDRESS THAT SHOULD BE TYPED WILL BE

http://localhost/First program.php

 

image9

 

TIP:-

In WINDOWS please don't type the name of the wamp folder in the address bar, however. This would be wrong, for example:

http://c:/wamp/www/test1.php

 

Also in linux please don't type the name of the var/www/html folder in the address bar, however. This would be wrong, for example:

http://var/www/html/test1.php

Attachment: image018.png



Please login to reply to this problem.