PHP is basically web programming language (Scriptiong Language) to develop interactive, and dynamic websites. Its server-side scripting and its execution is performed at server. As its Server-Side Language, it needs a Web Server (Apache, IIS etc) to execute its code.
PHP supports almost all platforms (like Windows, Linux, Mac etc)
PHP is used as programming language, to store data we use DBMS and we store data in databases. MySQL is most commonly used as DBMS with PHP.
We also need a web server to execute PHP code. We commonly use Apache Server.
There are two ways to Install PHP, MySql and Apache Server
- Download PHP, MySql and Apache Server and Install all three separately and configure
- Download and Install Package (like Wamp, Xampp) ( No configuration required)
I Suggest you second method. Download and Install Package. You can download and install one of them.
Note: You can watch the tutorials How to Install Wamp or Xampp on youtube. There is a lot of tutorials on this topic.
By Default it will create a folder with the name wamp/xampp in your C drive or in the drive in which OS is installed.
OS drive -> wamp/xampp->www ( C:/wamp/www)
In this tutorial I’m going to use WAMP server. After Installing wamp server, start wamp server by double clicking on wamp server’s icon.
Wamp server icon will be displayed on the Notification area of taskbar. After a few seconds, icon will turn to green. ( If you have skype installed in your system then port conflict may occur. To solve this problem read my post Resolve skype and wamp/apache server conflict )
Now, open your web browser and type localhostin the address bar and press enter..
Note: If you configure your server for different port other than 80 then you have to use port also. Say localhost:8080..
Now go to the root directory where you’ll create your projects..
It can be access directly through wamp server’s icons from notification area. You just need to click on icon and then click on www directory. The other way is just go to the drive where you install your wamp server (by default its C drive) and then go to wamp, and www folder. www is the root directory. You can create your files and folders for your projects here..
Lets create a folder with the name myproject.
Now we’ll create our first Hello world php file. To do this, open notepad and write the following code.
echo “Asalam-0-Alykum, Its Working”;
and save this file with the name test.php in myproject folder which we have created earlier.
We write PHP code within. Short open tags ( ) can also be used. We can write PHP code anywhere in the page. echo is used to print something on the page.
You cannot open a php page directly from the browser, you can open the page only through your localhost.
Now to open this test page, write localhost/myproject/test.php in the address bar of your browser and press enter.
Hope you learnt something from this tutorial. I’ll post part 2 of this tutorial soon..