DEV Community

Cover image for How to set up a PHP Console
Arwaz Khan
Arwaz Khan

Posted on

How to set up a PHP Console

Hello Dev's

In this blog, we will learn how to set up a PHP console.

Why we need this?

PHP is a server-side language (Backend) of web development.
In general, we don't require to take input from the console but sometimes for a small function or block of code, we require this because we don't want to disturb our whole code. It is also required to run some code that does not require a webpage (Interface) or sometimes we must require to take input from the console.

Requirements?

  1. Server: Xampp or WampServer

How to set up this?

First, we have to set up a path in our system environment variable.
Step 1: Goto C drive where your Xampp is installed
step 1
Step 2: Goto php folder in Xampp folder
step 2
Step 3: Copy the path of that folder
Step 3
Step 4: Now Goto System Properties then Advance System Settings
step 4
step 5
Step 5: Goto Environment Variables and follow the below steps and paste the copied path and press ok ok ok...
step 6
step 7
step 8
step 9

Now How to run the php file?

Step 1: open command prompt go to the directory where your code is saved ...
you can use cd command like cd C:\xampp\htdocs
Now to run php code use this command -> php file_name.php

step 10

Hope you will understand 😊....
If you have any problem you can comment below.
Thankyou 🙏

Top comments (0)