How to Execute PHP Code?

Posted by Bhavesh Joshi On Saturday, June 30, 2012 0 comments
PHP Interpreter
As we know that PHP language is used create dynamic web-pages or we can say that a dynamic web-site. PHP is a server side scripting language that can be used in web browsers. PHP can be embedded into regular html code, just like JavaScript and CSS, if you change the file’s extension to PHP. It allows a developer to perform more complicated operations possible within the web environment. Because PHP is server side, it offloads much of the computations from a visitor’s web browser, to the internet server.

Today, millions of web-sites using PHP codes. For beginner, it is really unique language to learn in order to design (create) dynamic web-page. PHP code execution process is really different with respect to html, css, javascript, etc. As we know that HTML code can be easily executed with the help of notepad (text editor) in which all we need is to enter our html code and save it (notepad file) with .html extension and then, open that file caused executable code will show in browser. But, PHP script execution is different. The PHP script is firstly executed on the server, and then, the plain HTML result is sent back to the browser. So in this tutorial, I am gonna to showing you- how to execute PHP code?     

In order to execute PHP code easily, just download WampServer or XAMPP from internet and install it in your computer. Actually, these softwares are used to make own server in order to execute PHP script. These softwares are completely free to use and very efficient.

WampServer

Xampp for Windows
     
Here, I am using WampServer for PHP code execution process.  

After installed WampServer, put it “Online” as-

Wamp Server Put Online

In order to check, WampServer is working or not as open any browser (like Mozilla) and type in address bar- “localhost” and press “enter” button from your keyboard then, WampServer Web will open.

localhost

Now, write your PHP code in notepad file and save it in “.PHP” extension. If you don’t know PHP language then, go-to site- w3schools.com and learn carefully.  

Here, I am just making a simple PHP file and showing how to execute it. So open notepad, write code and save with “.php” extension in folder named “www” which is in your location- “c:\wamp\www”.

php.php file

php.php

Open web browser and type in address bar- “localhost/php.php” and then, you will get result of your php file.

TechKoW.com

In this way, a PHP script got executed. I hope you like, feel free to make comment (feedback) and check out more tutorials and ideas in order to learn something new…

0 comments:

Post a Comment