PHP codes can run on your system with the help of a virtual server. Here in this post, we’ll take a look at the setup and tools that you will require to run “PHP codes”, “PHP sites” or “integrated into HTML or other scripts” on your computer system running Windows operating system.
As you know that PHP is a server-side language that why you will require to create a virtual server on your computer which would help you to run process PHP codes. Here the tool that we will use, uses the “Apache servers” to execute PHP codes.
There are a lot of methods via which you can run PHP codes on your system, and from PHP codes it means PHP integrated into an HTML page or other languages like javascript, SQL, MySQL, etc. You can run all of it at once using this method. So let’s begin it.
Key points :
- Download a software (Xampp)
- Configure it and place the project code or code file on a location.
- Use localhost (URL) on “Chrome” to “execute” PHP code/site.
Before setting up you will need some tools (software). The name and download links of these softwares will be provided below. The download links are from the official pages.
We need XAMPP to use virtual servers.
Table of Contents
Download XAMPP :
To download XAMPP visit the official site from here.
Click on the download button. Download for Windows, this will work on any windows version.
This action will download a setup file of the XAMPP (size <200MB).
After the download completes, it’s time to install it on our system.
XAMPP Installation :
Installation is simple like other software.
Double click on the downloaded “setup” file of “XAMPP” software. A small installation window will appear. Click “next”.
Now select the “servers” and “programming language” that you are about to use. Select “all” if you want. This won’t need any other software or tools to download. Click “next”.
Now select the location to install ‘XAMPP’ on your system storage. By default, it is set to “C:\xampp” if it’s good for you then don’t choose other location. Click “next”.
Select software language. Click “next”.
Click “next”.
Click “next” again.
Now the unpacking and installation process will begin, wait for it. It might take several minutes (4-6).
After the installation completes, click finish.
This will start the XAMPP control panel, now you can use the servers to run different programming languages includes “PHP, MySQL, etc”.
How to Run PHP code via XAMPPÂ
To run PHP programs or code integrated into an HTML page or others or as separated. First, open the XAMPP control panel. And start the servers that will be needed for your task. After the servers are successfully started it means that the servers are online and perfectly working on your computer system.
Now to run codes or sites place them inside this location
This PC>local disk C>xampp>htdocs
Make a folder there, and write your programs or codes there.
Now open chrome browser and type localhost on the search bar, press enter.
A dash board like below will appears with url http://localhost/dashboard/.
To run any site or code type localhost/your folder or file name.
This will process the PHP code or HTML code along with javascript or other codes.