PHP is a server side scripting language. For those who are beginners in PHP programming let be clear that you need to have a virtual server on your computer to execute PHP scripts on your PC. This tutorial will guide you right from installing a server and executing a simple PHP script.
The best available server is WAMP server that takes care of PHP, APACHE and MYSQL database. is WAMP server.
This tutorial will guide you to install a WAMP server and use it, in simple words. It is not at all necessary for you to have background knowledge of PHP as far as you are installing the server.
First install the setup file from WAMP official website. There are two versions available individually for LINUX/Windows. Choose appropriate you are working on. You can do that from here.
After you have downloaded setup file, start the installation. Installation is same as installing any other game. Do not change any settings while installation. All settings are default and best for use. Just click ‘next’ every time a screen appears.
- LAUNCHING THE SERVER
After you are done with installation part, A WAMP server icon appears on your desktop, double click the icon. As soon as you do it, image appears on the task bar just adjacent to your computer time is displayed.
Click it, this is what you will be seeing.
Click the localhost option and your PHP server will launch followed by a browser opening up with some contents displayed on it. Just like in the image below.
- EXECUTING FIRST PHP SCRIPT
Now let me show you how to execute a simple PHP script on your computer.
Let us consider a simple PHP script
Echo “ hello world ”;
1.) As you write your script in notepad/editor save all your files with .php extension to the directory c:/wamp/www. Now this WWW directory in c:/wamp/www is automatically created when you install your WAMP server
2.) Assume you have saved the script as demo.php in c:/wamp/www. To execute this come to the browser and after http ://localhost/ write demo.php
3.) Hit Enter button, the output will be displayed in no time.
For better understanding of installation and execution of PHP script have a look at the video.
Let us know if you have any questions.
Comments are closed.