Labels

Monday, 10 October 2016

Getting started with php

Image result for php










  


What is PHP? 

 PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. 
PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.


        PHP is an acronym for "PHP: Hypertext Preprocessor"

        PHP is a widely-used, open source scripting language

        PHP scripts are executed on the server

        PHP is free to download and use

        PHP file has the extension ".php"



 What Can PHP Do?



    PHP can generate dynamic page content

    PHP can create, open, read, write, delete, and close files on the server

    PHP can collect form data

    PHP can send and receive cookies

    PHP can add, delete, modify data in your database

    PHP can be used to control user-access

    PHP can encrypt data





With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML.

PHP has the following advantages:


    PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)

    PHP is compatible with almost all servers used today (Apache, IIS, etc.)

    PHP supports a wide range of databases

    PHP is free. Download it from the official PHP resource: www.php.net

    PHP is easy to learn and runs efficiently on the server side



How can i get started?


To setup php on your PC, you need to perform the following steps:

                Get a software tool for localhost server to run on your pc

                Install and make some connections

                Test your connections

                Start running php script on your pc



To get a software and start running php on your pc, firstly Xamp or Wamp is mostly used software to run php script and here we are going to use wampServer to test and run our php script. To get wampserver click on the link below, locate and click the download option.



INSTALLING:

After downloading, double click to start installing, follow the guides and installation directions to finish installing.


TEST YOUR CONNECTIONS:

After installing, type 127.0.0.1 into your url browser, if it does display a page like the image below with no error message, that means you are good to go, else you need to make some more modifications in the php.ini file, search or find localhost then add a four figure to it.  e.g localhost:8080
Now restart your server and re-run the code.







START YOUR FIRST PHP SCRIPT:

To start coding with php on your machine, type the following code below into a notepad and save it as hello.php into the www root directory folder, from the Local Disk (C:) you will see wamp folder, open the it and save the hello.php into the www folder. Now go back to your browser and type localhost/hello.php it should now display "Hello World" if you set up your environment properly, no error message would be thrown.



<!DOCTYPE html>

<html>

<body>


<?php       

                $Hello = "Hello world.";

      echo $Hello;

  ?>

</body>

</html>





After running the code, it should display "Hello world" on your browser.

1 comment:

Anonymous said...

cool testing..