How i test PHP codes in pc ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

How i test PHP codes in pc ?

php is sever side programming language since how i test my codes in my pc ?

1st Nov 2019, 1:38 PM
Asitha D Jayasingha
Asitha D Jayasingha - avatar
6 Answers
+ 4
Another possibility is to call PHP from the command line. https://www.php.net/manual/en/features.commandline.php You can do for example this (on Windows): Download PHP from https://windows.php.net/download/ Unzip it into a folder called for example php. Then you need to add path to this folder containing php.exe to 'Environment variable' called 'Path'. If you do not know how to do it, you can specify full path to php.exe when executing scripts. Create some test folder and create a new file with some php code (for example thescript.php). Then open command line, switch to that folder (or specify full path) Simply call the script by: php -f thescript.php You can even use built-in web server https://www.php.net/manual/en/features.commandline.webserver.php
1st Nov 2019, 1:58 PM
Michal Straka
Michal Straka - avatar
+ 10
Download and install wampserver. Create folder for storing files in C:/wamp/www/yourfoldername. To run file :on your browser type localhost/yourfoldername/filename
3rd Nov 2019, 10:47 AM
Ayushi Gujarati
Ayushi Gujarati - avatar
+ 2
You need to install a server on your computer to test it out. On Windows, I don't know how (but I've seen before people use XAMP or something, look it up) But if you're on linux, then the most commonly used one is Apache2 server.
1st Nov 2019, 1:45 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
WAMP. Google wampserver.
1st Nov 2019, 3:50 PM
Xyenia 🦉
Xyenia 🦉 - avatar
0
السلام عليكم
3rd Nov 2019, 7:08 PM
اسامه ابو عسيب
اسامه ابو عسيب - avatar
0
If you have already installed php, you just download Apache server and use it as localhost to test your code inside the browser. or you can use stacks such as wamp(windows), mamp(Mac), lamp (Linux) or xampp (any os). I prefer stack because it will come with MySQL also. So it's very useful when work with database.
4th Nov 2019, 3:05 AM
Vignagajan