In this part we will learn how to execute a PHP program using WampServer. WampServer is a Web development platform which allows us to create web applications with Apache2, PHP and MySql Database with just a few click. In coming parts we will learn how to configure and use Database Server, installation of popular CMS like Wordpress, Joomla, Drupal etc. Let's start installation of our WampServer so that we can run PHP code.
1. Download WampServer from here and double click the downloaded file to begin WampServer installation.
2. Just follow the instructions from the installer and you'll be done installing WampServer within a few clicks. In my case I have selected installation folder as D:\wamp64. Because D drive is free from any windows restrictions by default.
3. Start the WampServer by clicking either from desktop Shortcut or from Left Pane of Startup Menu.
In notification area, you will notice the WampServer icon starting with color red then amber and finally green in color. By hovering the icon you will notice a popup message showing local server - All services running . On clicking the WampServer icon you will see all the individual software which are already setup by the installer so that you can use your local server to test your very first PHP Program.
Let's test our local server first. Type the following address in your browser's address bar and hit enter.
127.0.0.1
If you type localhost instead of 127.0.0.1 same screen will appear.
We have successfully installed our local server. Now let's test our very first PHP program. To create a PHP program, we will create a folder inside www folder, which is in your WampServer installation folder. This is the only location where you must create any PHP project like WordPress, Joomla, Drupal etc. In my case my WampServer installation folder is D:\wamp64.
Let's create a folder inside www folder of WampServer installation folder D:\wamp64 and give the name 1st-php-project
Double click the folder 1st-php-project, right click mouse button, select New then select Text Document. A New Text Document.txt will be created. Double click the file you have created and type the following line of code inside it.
<?PHP
echo 'I know how to run a PHP Program in WampServer';
?>
Save the file and exit from notepad. Now rename the text file by pointing the mouse cursor on it, right click the mouse button and and select Rename. Rename it to index.php and press enter. Select Yes on confirmation dialogue box.
Now let's run the PHP program we have created. To run the program open your browser and type http://localhost/1st-php-project and hit enter. Here is the execution output of your very first PHP program
You will get same result if you type http://127.0.0.1 in your browser's address bar.
In this part, we have successfully installed our local server and tested our very first PHP program! Let's move on to Part-2 of this series.
0 comments:
Post a Comment