Skip to main content

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?

Comments

Popular posts from this blog

MySQL Connection

Connection with MySQL Database Before accessing database, you must create a connection to the database Syntax: mysql_connect(servername,username,password); where, servername specifies the server to connect to. Default value is “localhost” username specifies the username to log in with. Default value is the name of the user that owns the server process. To connect offline we use username “root”. password specifies the password to log in with. Default is “” Code : Creating connection to the database and selecting the required database <?php $con = mysql_connect(“localhost”,”root”,”"); if (!$con) { die(‘Could not connect: ‘ . mysql_error()); } else{ mysql_select_db(“test”, $con) }; ?> Here, we have store connection in a variable called $con and trap error using die function. Closing connection The connection will be closed automatically when the script ends. To close the connection before, use the mysql_close() function: <?php $con = mysql_conne...

Join in MySQL

Join clause is used to combine rows from two or more tables depending upon common field between them. There are different kinds of Joins. The most common and useful Join is Inner Join. Inner Join: It will return all rows from multiple tables where the condition is met.

Div and span

Div: Div <div> tag is that it divides the HTML document into sections. Proper usage of the <div> tag is fundamental to good HTML coding, the <div> tag is one of the most powerful tools available to a web developer. Span: Span <span> is  in-line level elements, they only span across small amounts of content, typically words or phrases. For example: a <span> tag might be used to make a word red in color or to give it an underline.