How to run php code without any server | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to run php code without any server

means like HTML can we run php code?

26th Dec 2016, 4:28 AM
Mayur Bagul
Mayur Bagul - avatar
8 Answers
+ 5
or use xamp wamp lamp on a pc. wamp = windows apache mysql php. lamp = Linux Apache mysql php.
26th Dec 2016, 7:24 AM
Ian Croasdell
Ian Croasdell - avatar
+ 1
No! You cant run a .php file without any local web server! Use xampp , wamp, or mamp local web seever in order to run your .php file
26th Dec 2016, 5:13 PM
Macky Miro
Macky Miro - avatar
+ 1
in our PC on window 7 we have any server by default?
27th Dec 2016, 4:27 AM
Mayur Bagul
Mayur Bagul - avatar
+ 1
You have to install local web server xampp
27th Dec 2016, 6:22 AM
Macky Miro
Macky Miro - avatar
+ 1
[Wow, how many people think that it's impossible to run php code without server...] Yes, you can run PHP code without server. Install PHP alone (even then it has it's own built-in or should I say "packed-in with interpreter" server but I never tried it, and yuou can be sure it's unefective to use it for php code as a server-side code). You can then run a php code writen for example in one of simpliest text editor(s) (notepad, nano, vim... uh, no, the last one isn't so "simple"😀) and saved as a .php file. But (and thats why some people think that this is imposible at all I guess) you wouldn't be able to "output" results in a "web-view" as in browser (or just "in browser") simple one code will output something in console, and I've heard PHP too has libraries/frameworks to build some GUI applications (but never tried those tools too… and what's for? ☺ when there are C/C++, Java, C#, Python if you are okey with interpreted languages and their "speed"). I guess yo won't get predefinedc vartiables for example too :-) and so on. So it's not common use of PHP [but still " yes, you can].
13th Jun 2017, 7:48 PM
Andrew Harchenko (Tomsk)
Andrew Harchenko (Tomsk) - avatar
+ 1
Currently PHP including built-in webserver, just run this syntax in your PHP Project folder: php -S localhost:8000 Requirement: min PHP 5.4.0 #You can't run PHP without webserver
22nd Jun 2017, 6:42 PM
Garuda
Garuda - avatar
+ 1
@Garuda What will happen after this: php myfile.php -r if myfile.php will contain: <?php echo "Helo world!"; ?>
25th Jun 2017, 4:35 PM
Andrew Harchenko (Tomsk)
Andrew Harchenko (Tomsk) - avatar
0
no, you need to get a server.
26th Dec 2016, 4:35 AM
Nahuel
Nahuel - avatar