Reputation: 551
Sorry if this is a very novice question - I am a novice - but, I have no clue how to run my php file from the terminal.
I type in the mac terminal something like this: php test.php (where test.php is the file i'm trying to run) Then, I get this: Could not open input file: test.php
I think I'm having this problem because I didn't change the directory (not sure how to do that either).
Upvotes: 26
Views: 88999
Reputation: 1
Start a terminal window. at the prompt enter 'emacs hi.php' in the emacs editor enter a line that reads print "hi world" enter cntl x-s to save your file then enter cntl-z to exit to the terminal window then type php hi.php you should see "hi world" displayed in the terminal window. then type fg to return to the emacs editor.
Upvotes: 0
Reputation: 2973
In order to change the directory, you must type cd and then the file path name
If you find the file in Finder, and hold the file, and drag it to the mac terminal window, it will place the entire path file....so just type cd, then drag file to get path
and that will take you to the directory of the file..
after that, just type php test.php
, and that should work
Hope this helps!
Upvotes: 48