Thursday, April 26, 2012

PHP basics and Installation, Getting started

PHP basics


Dear friends,

here i am explaining the basics of PHP (Installation, Configuration, basic Syntax , Building a simple web site   etc) , i have gone through hundreds of tutorial in Net, and finally Decided to create one for Beginners who have the Basic knowledge of HTML , the Details given below is a mixture of my own and collected from net
if you find any error or any doubt please feel free to Contact me

What is PHP?

  • 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 is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly." 

This is generally a good definition of PHP. However, it does contain a lot of terms you may not be used to. Another way to think of PHP is a powerful, behind the scenes scripting language that your visitors won't see!
When someone visits your PHP webpage, your web server processes the PHP code. It then sees which parts it needs to show to visitors(content and pictures) and hides the other stuff(file operations, math calculations, etc.) then translates your PHP into HTML. After the translation into HTML, it sends the webpage to your visitor's web browser.


PHP was first created by Rasmus Lerdorf in 1995, and saw its first official release in 1997. Milestone releases included PHP 3 in 1998, PHP 4 in 2000, and PHP 5 in 2004. Today, many large-scale websites run on PHP. The author was first introduced to PHP in 2000, and have found the language to be pretty easy to work with.  Below is a simple "Hello World" program, PHP flavor:  <?php   print "Hello World."; ?>  Executing this program on a web server enabled with PHP produces the following output:  Hello World.


What is a PHP File?

  • PHP files can contain text, HTML tags and scripts
  • PHP files are returned to the browser as plain HTML 
  • PHP files have a file extension of ".php", ".php3", or ".phtml"

PHP Installation

Download PHP

                  Download PHP for free here: http://www.php.net/downloads.php

Download MySQL Database

                 Download MySQL for free here: http://www.mysql.com/downloads/

Download Apache Server

                Download Apache for free here: http://httpd.apache.org/download.cgi

You need to install all the Above separately and configure 

(AppServ is a full-featured of Apache, MySQL, PHP, phpMyAdmin. You can setup in 1 minute.
        Package of AppServ
             - Apache
             - PHP
             - MySQL
             - phpMyAdmin
)

(for this tutorial we have used widows 7 Operating system )

Installing  AppServ


1.then double click on the .exe file

2 .Give the Installation Directory - C:\AppServ (default)

3.Select the   Package of  AppServ
 
4.Give Server Name and email

5.Enter Root password  ( NB: Remember this password)


6.Installation Successful

and open Browser and type  http://localhost/phpinfo.php

if you are getting the following screen then your AppServe Installation is Successful



Writing your first PHP page

Basic PHP Syntax

A PHP script always starts with <?php and ends with ?>. A PHP script can be placed anywhere in the document.
On servers with shorthand-support, you can start a PHP script with <? and end with ?>.

where to put your PHP files in server

C:\AppServ\www is the default directory to put your php file

First php file , write the following code

<html>
<body>

<?php   echo "Hello World";  ?>

</body>
</html>


save this file as  hello.php ,put in side C:\AppServ\www\test   (test is our site )



then open this file in browser

 
so you are ready for doing PHP programming

Reference :-  





8 comments:

  1. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    python Training institute in Pune
    python Training institute in Chennai
    python Training institute in Bangalore

    ReplyDelete
  2. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    Data Science training in chennai
    Data Science training in OMR
    Data Science training in chennai
    Data Science Training in Chennai
    Data Science training in Chennai
    Data Science training in anna nagar

    ReplyDelete
  3. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
    Microsoft azure training in Bangalore
    Power bi training in Chennai

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete