We need some configuration to run the .php file in your operating system. We need a requirement of one software to configure the PHP development environment in your operating system. To run the .php files or code, You need AMP Package i.e. Apache, Mysql, and PHP. In this tutorial, we will not set up all these separately. We will set up all these with the help of software.
There are many available software in the market that provides AMP packages.
- WAMP Server: For windows
- LAMP Server: For Linux
- MAMP Server: For Mac
- XAMPP Server: For Cross-Platform. It also includes other functionality such as OpenSSL, FileZilla, Webalizer, Mail, etc.
Let’s know more about the XAMPP software.
XAMPP is open-source and cross-platform software that is used for the PHP development environment and also it includes other components such as OpenSSL, FileZilla, Webalizer, Mail, etc. The XAMPP stands for Cross-platform, Apache, MariaDB(Mysql), PHP, and Perl.
Why use XAMPP?
- In order to run the PHP code in your server or OS, You need to install PHP, Apache, and also MYSQL. It is not easy to configure separately. PHP requires a Web Server to run the code.
- XAMPP provides easy to to use Apache, MYSQL, and other components such as OpenSSL, FileZilla, Webalizer, Mail, etc. You don’t have to memorize the command to start the Apache server.
Download XAMPP Software
For this tutorial, We will recommend you XAMPP software for Apache Server. Here we are downloading for the Window OS but you have to download according to your OS.
After downloaded successfully, just click the Next button. After successfully installed, You have completed the setup for the PHP environment on your Operating system.
Web Server Configuration
Now, We will know about the basic configuration of the webserver. We have assumed that you have installed XAMPP software successfully as described above. If you have installed successfully then you can find the following file structures below inside the C drive.
- htdocs – This is the root directory. All the PHP code will be placed here.
- mysql – This directory contains all the MySQL information which is run on 3306 port.
- php – This directory contains all the PHP installation files. There is one important file i.e. php.ini which is a configuration file. On the basis of this file configuration, Your PHP server will run.
Apache will run on the port 80 by the default. You can use another port also if it is not available. For example, If you are using the SKYPE software then it also uses port 80. If you want to run the Apache server then you will have to close SKYPE software.