Learn PHP Online | Free PHP tutorials

learn php online

What is PHP and Why do we need it ?

PHP ‘s full form is Hypertext Preprocessor (earlier, it was Personal Home Page ) , it a server side scripting language which is used to get Dynamic HTML pages quickly which is also loosely typed and has cross platform compatibility Some popular websites like Facebook , WordPress ,Photobucket are made using php .

We can broadly classify the webpages on Internet into two types: static and dynamic.

Static web pages are those pages that never change their content. They always remain the same while dynamic pages as the name suggests are dynamic in nature. Their content can change as per the developer’s wish. The data displayed on dynamic pages is most often fetched from a database about which we shall discuss later on.

So now we don’t need to make multiple similar single pages in a website but we can have a single php page whose can be fetched form the database.

PHP files end with a .php extension and are always stored on a server. A php file is processed by a server (read executed on the server) and a dynamic HTML output is sent to your browser. This dynamic HTML output is what you see on your screen. So, the next time you see a web page ending with .php displaying different content at different times to different users, you know what it is.

Before learning PHP web development some prior requirements are :
–Basic knowledge of HTML (HTML Tutorials)
–Familiar with C language. (However if you aren’t, worry not. We have everything covered for you.)

Stuff you’d need to install on your local system to run a php script:
–Server, such as Apache
–PHP
–Database, such as MySQL

Instead of installing individual components separately, we recommend you to install Xampp server (Runs on Windows, Linux & Mac)

— Win/Linux/Mac
A — Apache Server
M — MySql Database
P — PHP
P — Perl (Yeah, Xampp runs perl too!)

and an
–Editor, such as Notepad++ (Notepad will work too)

So now that you are all set, without further ado, let’s begin with a very basic program that will set you up in running your first PHP script.
PHP scripts work in tandem with HTML. So it can be placed anywhere in the document.

A PHP script starts with <?php and ends with ?>

 

Example of a simple PHP file.

 

“echo” is a built-in function which is used to output the text “HelloWorld!” on a web page:

  • Create a new folder inside C:\xampp\htdocs (if Xampp is installed in C Drive) .
  • Rename the folder as newclass. Now create a new file.
  • Copy the code in the example and paste it in the new file. Save it as index.php in the newclass folder.
  • Run Xampp. Start Apache and MySql services.

  • Go to browser and enter the URL in the address bar: localhost/newclass OR localhost:80/newclass OR localhost:9090/newclass (if 9090 is port Apache is running on; 80 is the default port)

Hope you had fun learning a new programming language. Leave us your queries (if any) in the comment section and we’ll answer it.
Be an early bird and get our tutorials notification through email , Subscribe below
Read this Article offline also , Download PDF Version by clicking the pdf icon

Leave a Reply

Your email address will not be published. Required fields are marked *