I am using xampp to build a database. I have written a file in NotePad++ as a php file and tried to open it in Chrome, and all it did was display all the text, unescaped, contained within the notepad file, instead of executing the contents of the file (which was display a deliberate error message). What happened?
Asked
Active
Viewed 952 times
1
-
Does it work with another browser? – ivion Dec 06 '18 at 13:20
-
Hey man! In XAMPP, have you turned on Apache? Also, where have you saved your file? With XAMPP you need to save it in the htdocs folder inside XAMPP. If you are using windows, its C:/xampp/htdocs – Sebastian Berglönn Dec 06 '18 at 13:20
2 Answers
1
You are using xampp so put your files inside the htdocs folder of xampp folder. Then access the page : localhost/myscript.php
in your browser

pr1nc3
- 8,108
- 3
- 23
- 36
-
The file is in htdocs. The latter part of your answer showed me what to do. – JohnnyApplesauce Dec 06 '18 at 13:29
1
Web browsers are not code interpreters. Web servers like Apache or nginx utilize other libraries (in PHP's case its usually PHP-FPM or PHP FastCGI Process Manager). They execute the code and return text which may contain HTML or other content to be displayed to the page which is what the browser gives to you.

bhooks
- 409
- 5
- 16