Getting Started with PHP
Before we create the first program or dynamic web pages or websites in PHP. We should know about the local web server. Because we knew that PHP is server side scripting language. It will be code executes on a web server. Also, we should have a basic knowledge of HTML and CSS.
Setting Up a Local Web Server
Basically PHP script executes on a web server. So before you start writing any PHP program we need about the local web server.
The PHP Community Provides Some types of the local web server. These are the following:
- WAMP Server
- LAMP Server
- MAMP Server
- XAMPP Server
One of the above web servers must be installed on our computer. When we start learning PHP or creating the first program in PHP, a web server is installed on your system.
All these local web servers having PHP, MySQL, Apache and operating system base configuration file, it doesn't need to configure manually.
Create Your First PHP Script
Above give web servers, If you have successfully installed any one web Server on your computer. Go to your web server directory, where you have installed web server on your computer system. Like C:\xampp\htdocs\ or C:\wamp\www and we create a very simple PHP script that displays the text "Hello, Developers" in the browser window.
If you have installed xampp, you need go C:\xampp\htdocs\
If you have installed wamp, you need go C:\wamp\www
First of all, create your project folder where you have installed your web server and then inside the project folder, You will create a simple PHP file with any name you want to.
Next,open up your favorite code editor and create a new PHP file then type the following code:
// Display greeting message
echo "Hello, world!";
Now save this file in your project folder (located at C:\xampp or wamp \www\project), and view the result in your browser through visiting this URL: http://localhost/project/filename.php.