Web Design,Programming,Mobile,iOS/Android,GameDev,IT Businness,eCommerce,Social Media


Tuesday, 11 February 2014

Getting Started with PHP - What is PHP ?


PHP Logo

Hello World. This text is meant for absolute beginners in PHP. PHP is a dynamic server sided scripting language which we can use to build simple and complex websites. Dynamic means that PHP has the ability to take decisions based on different behaviors or clicks on our website, show different portions of contents, make calculations and other great stuff.

We cannot tell how much PHP is capable of in single text, rather we will focus on how to get started with things simple PHP page and show simple text on browser.

Gathering the Tools

First of all to write code you will need an IDE with syntax highlighting and indentation. Do a search on Google for PHP IDE's and you will find plenty of them. If you are a beginner then a good choice for ( if you are a windows user ) would be Notepad++ or Programmers Notepad.

As we said PHP is server sided scripting language. Server sided means that PHP code only runs in a server with appache module and packages installed. If you don't understand what this is don't worry, just go ahead and install Xampp somewhere on your computer. This program will install binaries and other stuff including PHP which we can use to actually write PHP pages. You just start the program and start the Appache module. Open your browser and in the URL bar type localhost. If you see It Work's then you have successfully installed Xampp. Congrats !

After installing this program, navigate to your installation directory and find the htdocs folder. This is the folder where we will store our projects. Create a folder inside this folder and name it whatever you like. For simple testing purpose name it mypage, or testpage.

Writing some PHP code

Now we will write simple php code to test if PHP runs perfectly. Open your favorite editor and type this line of code and save it as index.php on your early created folder in htdocs.

<?php php_info(); ?>

In your browser type localhost/testpage or whatever you named your folder. Hopefully if you did everything as told, you will see a page with your PHP configuration settings which means that we can run PHP files correctly with the help of XAMPP.

Now delete everything on your index.php file and paste this code. Again save it and navigate to localhost/testpage to see the results.

<?php echo "Hello World, This is my first PHP page. Hurray !"; ?>

Congratulations on your first successfully programmed PHP page. Please refer to online documentation to proceed and subscribe to our blog for more awesome and simple upcoming tutorials.

Written by

Thank you for taking your time to browse through our blog. We try to build as much rich content base as we can. We focus in modern technologies, computer science design and business.


Post a Comment


© 2013 smartnoob . All rights resevered. Designed by Templateism