PHP PHP Basics Getting to Know PHP Intro to Workspaces and PHP Code

Nico Trivelli
Nico Trivelli
20,359 Points

Console + PHP + MAMP (on Win)

Hello there everyone,

I want to start this question by confessing I feel like a total dumb today :D

I have been for hours trying to figure out how to follow along with Alena on my computer.

In this video she's doing some PHP scripting on Workspaces console, and also obviously editing the PHP file. Also, I just installed the MAMP and set it up so I can see there anything browser related having my 'virtual local server'.

All went right except I tried doing the PHP scripting in my command line (I am on Windows 10) and get that 'php is not a command' classic message. I tried my Git Bash, and a similar message, so I finally decided going to the source and downloaded some kind of php console from the php site, but whatever I type in that console, it will only display it in the console, but when I hit return it does absolutely nothing.

I know I am probably and ridiculously missing something obvious (or not so much maybe?) but I can't pinpoint exactly what it is? How to follow along her in the console?

NOTE: My MAMP is already set up correctly; I already tested it.

Summary:

  1. I am on Windows 10.
  2. My MAMP works great.
  3. My console, Git Bash, Windows Command Line, PHP command line, etc. do not follow.
  4. How to follow along the teacher in my own computer (for the sake of practice gained 'on my own')?

Thank you in advance!

2 Answers

Corey Cramer
Corey Cramer
8,847 Points

The piece that it sounds like you're missing is adding PHP to your environment variables. I have some instructions below. After that open command prompt/powershell and type php -v to verify that it worked properly.

Press the windows key (or click on Cortana if you still have that enabled) and type: environment

Towards the bottom of the window that pops up there is a button called "Environment Variables...", click on that.

Now for either your specific user or system wide find the variable called Path, click that and click edit.

At the very end add a semicolon (;) and then the full path to your PHP installation (e.g C:\Program Files\php)

Click "OK" on all windows until everything is closed
Nico Trivelli
Nico Trivelli
20,359 Points

Oh man, I can't thank you enough Corey!!

This is second time you show me the way, and help me get out of my maze.

Thank you man! That did the trick. Now I can use it both from the cmd or from the Git bash itself.

Corey Cramer
Corey Cramer
8,847 Points

You're very welcome, I'm glad I could be of help more than once! If you have any other questions just post them up and I'll help where I'm able.