Php basic problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Php basic problem

I am not able to run php code properly. I have xampp server html is working good. But when I run php it displays source code. Please tell me what to do.

28th Apr 2020, 3:07 PM
Shubham Gupta
Shubham Gupta - avatar
4 Answers
+ 1
hmmm, well the browser runs html by himself so u can run it with xampp or without it, but in the other hand php needs a server to run it and here xampp comes, if you opened it as a file (C:\xamp\htdocs\YourFile.php) it's gonna show you the source code, the question is how did u open your file ?
29th Apr 2020, 5:20 AM
Mohammed Alotaibi
Mohammed Alotaibi - avatar
+ 4
Save a copy of the code in SL and share the link in your thread Description. It's hard to tell what the problem is without looking at the code. Follow this guide in case you didn't know how to share links. https://www.sololearn.com/post/75089/?ref=app
29th Apr 2020, 5:09 AM
Ipang
+ 2
first put your php file into ..xampp/htdocs then run your Apache from xampp console, after that go to your browser and enter your localhost ( localhost/Myphp.php )
28th Apr 2020, 8:09 PM
Mohammed Alotaibi
Mohammed Alotaibi - avatar
+ 1
I had done everything if I change the file name to hello.html then it runs the code but when It is hello.php then it doesn't work show source code.
29th Apr 2020, 4:54 AM
Shubham Gupta
Shubham Gupta - avatar