Tutorial - How to run PHP Programming Language in Command Prompt (CMD)
What is the purpose of this tutorial?
- Running PHP (Hypertext Processor) in CMD.
Requirements
- XAMPP for Windows (support PHP5 or PHP7).
you can download it here https://www.apachefriends.org/download.html - Notepad++ (all Version) here https://notepad-plus-plus.org
Remember : For all the requirements, choose according to your computer architecture.
Difficulty
- Basic.
Preliminary
Here, I will share how to configure Windows to recognize the php command in CMD. So it can be used for advanced composer and web development. The trick is actually very simple. Just enter the location (path) php into Environtment Variables only. This will look like we are running php in the linux terminal.
So, let's get started.
Procedures
1. Install the Software
Previously installed both software (the requirements) . How to install it as usual without any additional special tools and just press the next to complete.
If done then go to the next step.
2. Find Installed PHP Locations
After it has finished installing xampp, it then goes to the system directory (or directory C) and see xampp folder.
Then open the xampp folder, then open the php folder inside the xampp folder. usually are on c:\xampp\php.
This location will be used as the path address in the Environtment Variable.
2. Run System Properties
To run this process, press Windows + R key on the keyboard. Then the Run window will pop up and type this command below. Click OK if done.
%windir%\System32\SystemPropertiesAdvanced.exe
3. Enter to Environtment Variables
Press Button Environtment Variables.
4. Edit the Variabel Path
Select a path variable first, then click the Edit button.
5. Enter PHP Location
To add a value, make sure the edit Environment Variables window opens and click the browse button on the right.
After the browser window, open the C directory, then open the xampp folder and then click on the php folder (C:\xampp\php). Click OK.
After that, there will be a new value that we have added earlier in the value list in the edit Environtment Variables window.
And then subsequent to this step, Click OK and close System Properties window.
6. Experiment PHP Commands in CMD
Try typing the php --version command in the CMD. If the result is like the picture below, it means the php command has been successfully recognized on the CMD.
7. PHP File Execution Trial
Now, try to make file phptest.php. make it on Notepad++ which has been installed earlier.
and save it on E diretory.
After that, execution via CMD. Before executing, go to E directory.
Afterwards, type php phptest.php and click enter. If successful, will display the contents of the file as shown below.
Congratulations, Now PHP can be run through CMD.
Curriculum
This is the first tutorial i'm contributing using PHP.
Posted on Utopian.io - Rewarding Open Source Contributors
No matter approved or not, I upvote and support you.
Thanks @steemitstats
nice post @simpleawesome
Thanks @devarizaldi
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Thank you @jestemkioskiem
Hey @simpleawesome I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x