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

Jessica Diaz
Jessica Diaz
618 Points

Why is the console not executing the simple script I'm typing that goes along with the PHP Basics tutorial?

I just started PHP Basics tutorial video. Opened the console for the first time. I typed in php hello.php right after the treehouse: ~/workspace$ When I try to execute this, nothing happens when I press enter, treehouse: ~ /workspace$ appears again

3 Answers

-- --
-- --
12,382 Points

Hi Jessica,

Perhaps you forgot to save the file containing your code before trying to execute it? :)

Jessica Diaz
Jessica Diaz
618 Points

This really helped. I did forget to save it. Thanks so much

-- --
-- --
12,382 Points

Haha, no problem! :)

Jessica Diaz
Jessica Diaz
618 Points

Hi Mace, Would you happen to know a shortcut for saving scripts that doesn't include going up to File and pressing Save? Also, do you know of a shortcut to duplicate a line of code? It seems that the teacher's in the video know these shortcuts. Thanks so much. I really appreciate your help

-- --
-- --
12,382 Points

Hey Jessica,

Sorry for the late reply! To save a file, press CTRL + S (or CMD + S on a Mac). I'm not sure if you can actually duplicate lines of code in Workspaces, though - I simply used 'copy paste' while using the Workspaces. (Edit: I tried a couple of things and apparently the shortcut on a Mac is CMD + D - this doesn't duplicate the code onto a new line, though - but I'm not sure if CTRL + D works on a Windows machine, too).

I tend to work locally (you can use XAMPP on Windows or MAMP if you're using a Mac), though, so I download the files and edit them in an actual text editor (these have more commands). I personally use Atom (and use CMD + Shift + D to duplicate a line of code / code block onto a new line), but you might like Sublime or Brackets better.

~ Mace