Building Web Application Using PHP Step 1
PHP Logo |
PHP is a general-purpose programming language but it’s mainly used for building web applications. It can be used to create web applications pretty quickly with some easy set up and programming syntax to learn.
Building web applications can be done quickly by using PHP because PHP is very specialized for building web applications, along with MySQL and Apache web server. Here ‘s how to start creating web applications in PHP.
The first thing you need to begin with web programming in PHP is to install the server stack, which is Apache web server, MySQL and PHP itself.
1. Setup Apache Web Server
To install Apache MySQL and PHP in Windows, Linux or Mac OS, full stack web server, you can just use XAMPP, it’s a bundled server stack that inside it contains all the server stack you need, so by installing XAMPP, you don’t have to install them separately.
Visit XAMPP official website here https://www.apachefriends.org/download.html, download and install the XAMPP and Version you like to use.
To run the installation wizard:
- On Windows you just have to click in the installer file and will open the installation step.
- On Linux you must first chmod the installer into executable binary.
chmod 755 xampp-linux-VERSION-installer.run
And then execute that installer using a sudo operation like this.
sudo ./xampp-linux-VERSION-installer.run
- On Mac OS follow these steps to install XAMPP, execute the following command to mount the application.
hdiutil mount xampp-osx-7.2.0-0-installer.dmg
Now open the XAMPP installation wizard by using open command.
open /Volumes/XAMPP/XAMPP.app/
Then it will open up the installation user interface, you can just follow the step and wait until the installation process finishes.
2. Start Apache Web Server
Now open the XAMPP control panel and start Apache and MySQL.
Write your first PHP programming language code in the htdocs directory:
- On windows it is c:/xampp/htdocs
- On Mac OS, go to: volumes, click the [mount] button, and finally click explore.
- On Linux it’s located at /opt/lampp/htdocs
Create a file named index.php file and write the following code.
<?php phpinfo();
Now open our web browser, and type http://localhost:8000, it should look something like this.
That’s it, how to set up your first web application using PHP, you can begin to learn more advanced stuff building web applications in PHP. PHP is the most convenient way to start with web programming. If you are a beginner it’s easy to get started and learn the language, to build a fully functional web app.