Friday, August 14, 2015

Running PHP Program Using Command Prompt

We can run php program by using command prompt too. But there are some differences if we are using XAMP beside cmd. In cmd, html codes can't be identified, so just don't use html syntax if you are gonna use cmd for compiling your php program. Okieee... let's just use pure php style as shown below :
Save above code, then open command prompt on the same directory where We save our php code. Theen type "php yourPHPcode.php" in command prompt :

Running PHP Program Using XAMPP

In this post we will gonna learn about compiling php program using XAMP that is running on windows8. So the first we have to do is installing XAMPP. You can see the installation process from this post. Then after installing it, go to htdocs folder that we can find withing XAMPP folder installation, then make your own folder there. The folder that I have created is shown below :
Then let's make our simple PHP program  for example as shown below :
Save above code in PHPPOIPO folder or your own folder within htdocs.
Next, Run your our own XAMPP Control Panel and start apache server :
Open your browser, type "localhost/yourfoldername/yourfilename.php"
Yaaaaaikkzzz... That's all of it....

Btw... I'm using html header here, but actually we can use just php code as Shown below :
Result :
The results are almost same, so it's up to you which one you like ... :-)