Running PHP code on your compute |
How to run PHP code on your computer?
Hi friends, today we are going to learn about running PHP code on your computer. There are lots of questions asked by different peoples about running PHP code on their computer in different ways. Questions like, How to run PHP code on your computer?
To run PHP cond on your computer you have to configure your computer as a server. To configure your computer as a server you have to install Apache Server and for the database connectivity, you have to install MySQL or PHPMyAdmin. There are lots of software or packages which contains both Apache and MySQL. Software or packages like WAMP for Windows, LAMP for Linux, XAMPP for a cross-platform, etc. The most popular software is XAMPP because it is a cross-platform software. Here, I will use XAMPP software to continue our this tutorial.
Fires let us understand, What is XAMPP?
XAMPP is a package of the software which includes much software in a single package like, XAMPP v3.2.3 includes five software of Apache, MySQL, FileZilla, Mercury, and Tomcat. Simply, we can say that XAMPP is a server that is used for running the server-side languages like, PHP.
XAMPP stands for:
X --> For any operating system (Windows, Linux, etc.)
A --> Apache Web Server
M --> MySQL or MariaDB Database Engine
P --> PHP
P --> Perl
Click here to learn to install XAMPP on Linux.
Now, follow the given step to run PHP code on your computer.
Step 1: Download XAMPP package. Click here to go to the download page and choose your OS then download the XAMPP latest version or which you want to download. And, after downloading install the XAMPP package or software.
Note: Skip this step if you already have download and install the XAMPP.
Step 1: Download XAMPP package. Click here to go to the download page and choose your OS then download the XAMPP latest version or which you want to download. And, after downloading install the XAMPP package or software.
Note: Skip this step if you already have download and install the XAMPP.
Step 3: Now, start the Apache server by clicking on the Start button.
Step 4: Open your favorite code editor and write your PHP code and save it to the "htdocs" folder or save it in the "htdocs/yourFolderName", in my case I save the PHP code at location "htdocs/bloglearner" with the extension ".php", like "index.php".
Note: The default location of the "htdocs" folder is "C:\xampp\htdocs" , but in my case, it is in "D:\xampp\htdocs" because I installed the XAMPP in the D drive.
Step 5: Open your favorite browser and write "localhost/yourFolderName" i.e, in my case "localhost/bloglearner".
Now, you will able to see your output as Hello World!!!
Note: The index file view as the output file in PHP. Here, the "index.php" is the index file.
If you want to get output, other than index.php file, write the full URL for it. Like shown in the given screenshots below.
Creating another PHP file with and save it with "second.php". In my case, the path of the PHP file is "D:\xampp\htdocs\bloglearner\second.php".
To see the output of the second.php file write in your browser as "localhost/bloglearner/second.php", and press Enter from your keyboard.
Now, you will able to see the output of the second.php file as "Second Page."
Congrats!!! now you will able to run the PHP code on your computer.
How to run PHP code on your computer?
The short answer to run the PHP code:
---
I hope you likable this nice post. Do not forget to share it together with your friends, the Sharing Button is below the post. Apart from this, if there's any downside within the intermediate, don't hesitate to request the Comment Box. we are going to be happy to help you.
I will continue to write more and more on this blog, so do not forget to make our blog BlogLearner as a bookmark (Ctrl + D) on your mobile or computer and subscribe to us to get all the posts in your email. Do not forget to share these posts, if you like it. You can facilitate us reach additional individuals by sharing it on social networking sites like Facebook or Twitter.
Running PHP code on your compute |
No comments:
Post a Comment