Introduction PHP
PHP is a server scripting language which is widely used to make dynamic web pages. A free scripting language. Easy to use in your web server for dynamic pages.
Example of PHP code:
<!DOCTYPE html>
<html>
<body>
<?php
echo "I am a php web developer!";
?>
</body>
</html>
inside HTML code we can use php code like above. Starts with <?php end with ?>.
How to run php file?
If we use php
code in a page, to run that page we need to save as .php extension. Example
“example.php”.
We cannot run
php normally as like HTML. We need a server software. In this example I am
using Apache server. I will demonstrate how to run Apache server by Xampp
software to run local host server.
I am using this
software: Xampp software V3.2.2
You can download
here and install it.
In
server normally first page should be filename index.*. if it is HTML index.html and if it is php web
page the file should be index.php. Now create any folder to save this index file into a folder. Here I am creating a folder named “yourweb” into the folder “/xampp/htdocs” so the
path of the index file “/xampp/htdocs/yourweb/index.php” . Code of index.php is
<!DOCTYPE html>
<html>
<body>
<?php
echo "I am a php web developer!";
?>
</body>
</html>
<html>
<body>
<?php
echo "I am a php web developer!";
?>
</body>
</html>
Type this code
in a text editor and save the index.php file into “/xampp/htdocs/yourweb” folder.
Ok. Saved file.
Now how we should run this file in web browser. Run xampp control panel in
start menu. And click start “Apache” and “MySql” to run Apache server in local
host.
Then you type
the browser http://localhost/yourweb and enter now your index.php file will be open in your
browser.
Like Below.
Output of
index.php:
Please Note:-
I am using php script for my website to post free ads - Please click the link and check it out http://www.freeadsimple.com
To Learn Basic HTML Please Read the article from http://webdevelopmentstepbystep.blogspot.com
I am using php script for my website to post free ads - Please click the link and check it out http://www.freeadsimple.com
To Learn Basic HTML Please Read the article from http://webdevelopmentstepbystep.blogspot.com
Try the first
php file to run in your computer. Will continue in next lessons.
No comments:
Post a Comment