0

php is not woroking in my html code. php codes are converting as text here. i wrote the following code

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
 <!-- Bootstrap -->
 <link href="frame/css/bootstrap.min.css" rel="stylesheet">
  <link href="css/default.css" rel="stylesheet">
<title><?php echo "testing barta";?></title>
</head>
<body></body>
</html>

and the tile is showing in output

<?php echo "testing barta";?>

title should be only

testing barta

please tell what wrong i did?

& its a live webserver. You can check here http://windchimesys.com/bonik/ the php is working fine. You can check the following link http://windchimesys.com/bonik/hi.php

wind
  • 338
  • 2
  • 11

1 Answers1

1

This is probably a server settings issue. Is your server set up to run PHP? And if it is, is the filename .php? (Many server setups require the filetype to be php for it to run.)

(And if you are opening the file locally, PHP will not work, since it needs a server that is serving the pages. If you'd like to do that, check out a guide on installing Apache and PHP.)

David Manheim
  • 2,553
  • 2
  • 27
  • 42
  • its live webserver check the link http://windchimesys.com/bonik/ – wind Nov 09 '15 at 18:59
  • OK; is the server interpreting any other PHP code on the page? – David Manheim Nov 09 '15 at 19:02
  • Also, see the other question, here; http://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-i-can-see-it-on-source-code-of-page – David Manheim Nov 09 '15 at 19:02
  • php is workin fine on other page windchimesys.com/bonik/hi.php and in the html page there has only one php code , no other code is there – wind Nov 09 '15 at 19:03
  • 1
    The file type should be .php, not .html - if you can't change the file type, you can't use php on this page. You can try deleting the index.html, and replacing it with index.php, and see if that works - if you have permissions. – David Manheim Nov 09 '15 at 19:08
  • @wind i can see your file is saved as .html http://windchimesys.com/bonik/index.html change it to : index.php it will work – Arsh Singh Nov 09 '15 at 19:09
  • @arsh dear. i want to echo something into a html file. why i gonna save it as .php file? i have did lot of php echo under html in past. – wind Nov 09 '15 at 19:16
  • (It's likely that there are permissions issues - the index.html file may not me replaceable/deleted from the server, even though @wind can edit the title.) – David Manheim Nov 09 '15 at 19:17
  • 1
    It depends on the server settings. Have you done this successfully on this server with a .html file? If you have an example, we could investigate - but I think it's just not going to happen. – David Manheim Nov 09 '15 at 19:18
  • @DavidManheim : You are correct. `echo in .html`. Not Possible. – Nana Partykar Nov 09 '15 at 19:21
  • 1
    @wind :O. but wind you can run html in php file but not php in html file , you should go for .php extension seriously, accept the advice else your wish :) , try it hard , if someday you will get it work ,, let us know please. – Arsh Singh Nov 09 '15 at 19:21