How should i run .php files in Google Chrome?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How should i run .php files in Google Chrome??

After writing all the php codes when i try to open the file which is save as .php all the codes get displayed on my browser instead of displaying the codes which i wrote in echo part. I need a help.

18th Feb 2017, 2:14 PM
Nganaremba Shijagurumayum
Nganaremba Shijagurumayum - avatar
18 Answers
+ 11
open xampp, htdocs folder and create new folder inside the htdocs folder and give it an name " let's call it name". now put the .php files you create in this folder "example index.php ". it's very important to run xampp, after running xampp open browser and type http://localhost/name/index.php now you should see the content of the index file
18th Feb 2017, 5:54 PM
No Name
+ 5
You'll need a localhost server to run PHP on your PC try xamp after installing and configuring make sure you start the Apache server and the php file must be in the htdoc directory in the xamp folder go to Chrome and type localhost/your PHP file
4th Apr 2017, 11:07 AM
Mr. Lecturer
+ 4
index.php that's odd. is the page blank or what does it show? maybe you can post your code in code playground.
18th Feb 2017, 3:51 PM
Mario L.
Mario L. - avatar
+ 2
did you use <?php //code ?> to let the php interpreter know that it is php code?
15th Mar 2017, 9:24 PM
Ilke Tosunoglu
Ilke Tosunoglu - avatar
+ 2
How do i run a php code on chrome
14th Jul 2020, 10:13 AM
zubayr
zubayr - avatar
+ 1
save your files in root folder, .php extension. turn on your local server..type localhost in address bar, if its not working type localhost:8080, localhost:3036 etc. let us know what exactly you're facing
19th Feb 2017, 12:09 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
you need a localhost server to run PHP on your PC try wamp if using Mac try Mamp or Lamp for Linux after installing and configuring go to Chrome and type localhost/your PHP script
15th Mar 2017, 11:02 PM
Michael Awudu
Michael Awudu - avatar
+ 1
you must install a server apache in your machine, because php is a server side programming language 😊
23rd Apr 2017, 6:45 PM
Elghozi Nasreddine
Elghozi Nasreddine - avatar
0
i have already install xampp and started apache and mysql but still its not working
18th Feb 2017, 2:56 PM
Nganaremba Shijagurumayum
Nganaremba Shijagurumayum - avatar
0
where did you save the files?
18th Feb 2017, 3:41 PM
Mario L.
Mario L. - avatar
0
xampp/htdocs/dashboard/
18th Feb 2017, 3:43 PM
Nganaremba Shijagurumayum
Nganaremba Shijagurumayum - avatar
0
okay and you open them in chrome like http://localhost/dashboard ? do you see the XAMPP landing page when you just enter localhost?
18th Feb 2017, 3:45 PM
Mario L.
Mario L. - avatar
0
yes i can... but i have change the index.html file in the dashboard with my index file
18th Feb 2017, 3:48 PM
Nganaremba Shijagurumayum
Nganaremba Shijagurumayum - avatar
0
I think you have something misconfigured in XAMPP
18th Feb 2017, 6:28 PM
ThisTNTSquid
ThisTNTSquid - avatar
0
is apache running ? when you've install it did you choose a different port than the default port which is 8080 ?
19th Feb 2017, 6:48 AM
random599514214
0
get wampserver then save everything in the www file. run it all from that. id look up a tutorial on the wampserver tho. been a minuets since I used it :/
19th Feb 2017, 11:16 AM
Michael Szczepanski
Michael Szczepanski - avatar
0
you need server to run php. either run in local server or host it. for local server you can use xampp, for other platforms similar local server are available. install and run your php.
19th Feb 2017, 12:06 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
0
don't open the files from folders directly, instead, COPY this link to chrome localhost:(your port number)\dashboard\
27th Oct 2019, 3:27 PM
Shahzod O'ralov