hey I want to run php on command prompt with xampp server. I made 2 environmental variables C:\xampp\php and C:\xampp\mysql\bin. how to execute the php code now?
Asked
Active
Viewed 6,392 times
2
-
1Possible duplicate of [How to access PHP with the Command Line on Windows?](http://stackoverflow.com/questions/7307548/how-to-access-php-with-the-command-line-on-windows) – ArSeN Jan 17 '16 at 08:33
1 Answers
5
Run command from console
c:\xampp\<path to php>\php.exe <path_to_your_php_project>\your_script.php

Nick
- 9,735
- 7
- 59
- 89
-
1
-
yes. i can execute it now. but i have one more php file in which i have html code and php tag also. but when i execute that php file then i am getting html code as output in cmd. How can i solve this error? – Thakur Akshay Jan 17 '16 at 09:34
-
-
actually i have file upload code in html in which i am uploading photos and storing it in a folder on server. – Thakur Akshay Jan 17 '16 at 09:39
-
-
i am trying to learn the php from all aspect and i have heard that if we want to make client-server app then server code have to run through cmd. – Thakur Akshay Jan 17 '16 at 09:44
-
-
Yes, you can. For this purpose usually create a file what produces output with text formated for console. For example, ` – Nick Jan 17 '16 at 09:47