Tuesday, November 20, 2012

PHP Introduction and Installation

PHP is a powerful tool for making dynamic and interactive Web pages.PHP stands for PHP: Hypertext Preprocessor.PHP is a server-side scripting language, like ASP.PHP scripts are executed on the server.PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.).PHP is an open source software.PHP is free to download and use.
PHP files can contain text, HTML tags and scripts.PHP files have a file extension of “.php”, “.php3″, or “.phtml”.
PHP file can be written as follows:
<?php
echo “Namaste! Nepal”;
?>
Here, <?php is the starting tag and ?> is an ending tag. These must be included to write a php file. And echo is used to print output.


PHP Installation:
Installing PHP is very easy. You do not need to install PHP, mysql differently. There are softwares which does that. So you just need to install those softwares and create php files and browze.
For example you can download softwares like wamp, easyphp, xamp for free of cost and then install it wherever you want it in your computer.
After that start the server, and open any internet browzer and type localhost. For example: http://localhost/ and enter.You will see some instruction or information regarding PHP and everything. That’s it!! Now you are all set to go.
And to write/edit PHP code, its better to use Adobe Dreamweaver which gives you more flexible way to code rather than just using notepad or notepad++.
To view database, simply type http://localhost/phpmyadmin and you are done. Create database and tables and enjoy.
Happy coding !!
 How to write code and browze?
1) Open Adobe Dreamweaver, create php file.
2) Write your code their and save your file creating new folder inside the www folder. There should be www folder or htdocs folder inside the installed software.
3) After writing your code, open any browzer and type localhost along with your created folder and filename.
For example: http://localhost/myproject/viewFile.php
If you create filename called index.php then it will load automatically as you write your folder name only.
Example to do:
Create a new folder called myprojects inside www folder and their create a php file named myFile.php
Write following code below:
<?php
//this will display all the information about php
phpinfo();
?>
Browzing:
Open any in browzing but first start start your server and type
http://localhost/myproject/myFile.php.
wow!!!! that’s it. So simple, isn’t it?

No comments:

Post a Comment