Apparently learning Javascript through console seems like a pretty decent way to get basic stuff down, and goo new is, it can be done in for PHP too!
What you'll need:
- XAMPP Installer. It's just environment for windows where you can execute PHP scripts.
- Access to command line.
Alright, lets crack on! Install XAMPP form this link. When you're done. Open Command prompt and type in basic echo function that echos 5 + 1. Like this, "echo(10 + 1);". Without strings of course.
So! is it working!? Did it return 6? See.. well it's not working! but don't worry. I'm about to tell you how to make it work.
Alright! Step number 1.
Open My Computer.
Step number 2.
Right click anywhere - except on the drives and select Properties.
Step number 3.
On the left hand side, click on Advanced System Settings.
Step number 4.
You've now System properties window open. At the bottom click on Environment Variables..
Step number 5.
In the System variables area, find Path or PATH and click on Edit.. if you cant find it, click on new..
Step number 6.
In the Variable name field type "Path". And in the Variable value field type the path to the php.exe file. This file will be inside xampp folder, in php folder. So my path is C:\xampp\php. Click okay and close it.
Now lets head back to CMD and try the same thing we tried in the beginning - however with a little change, we want to tell CMD we're about to throw in some PHP code. So it does like this. "php -r 'echo 5+1'". It will return 6! -r parameter allows us to write in PHP code.
To see what different commands are available type in "php -h".
As you can see you can easily run PHP through command prompt now!






No comments:
Post a Comment