Hello guys pls I wrote php code in my html file saved it as a .Html file tried to open it on my browser it didn't work why | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Hello guys pls I wrote php code in my html file saved it as a .Html file tried to open it on my browser it didn't work why

<body ><?php echo"hello world"; ?> </body>

21st Nov 2017, 11:06 AM
Isaac Bello
Isaac Bello - avatar
4 Answers
+ 13
Because PHP is executed on server not on the client device.
21st Nov 2017, 11:08 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 8
you need a server search on youtube about xampp tutorial...... i also did the same thing once 😋 and also u must save php as .php not as.html
21st Nov 2017, 11:51 AM
Prashanth Kumar
Prashanth Kumar - avatar
+ 2
thanks
21st Nov 2017, 7:44 PM
Isaac Bello
Isaac Bello - avatar
+ 1
Because PHP is executed on server not on the client device, and while using xamp,wamp servers you have to save your file extension with .php instead of saving with .html extension !
22nd Nov 2017, 7:13 PM
Farhan Khan
Farhan Khan - avatar