Shelly300 Posted February 12, 2009 Report Share Posted February 12, 2009 I hope I am in the correct section for this request. A search on discussion threads using 'echo not working' (and variations of) yielded nothing that can help me.I have been having some trouble with some complex php pages. Just in case I was over complicating things I decided to go back to basics and do some beginners tutorials and found a very annoying problem: echo is not working locally.The tutorial starts with a simple helloworld.php page and when run locally there is no 'Hello World' displayed on the page. However, when the page is uploaded to a host server the echo works just fine and 'Hello World' is displayed. Therefore I know there is nothing wrong with the file.I have my Uniform Server installed with defaults and have been using it successfully without a drama from the get-go... until now.Firefox will give me a blank page without the echo displayed; IE7 displays the page as text (showing html tags); and Chrome downloads the page to be opened as a text file. Notepad is my default when opening php and inc files.Please could someone tell me what settings need to be changed in my local server to rectify this. Thank you Quote Link to comment Share on other sites More sharing options...
Ric Posted February 12, 2009 Report Share Posted February 12, 2009 I cannot explain your observations, there are no special settings to get echo to function.Can you post your code? I would like to see if it’s reproducible on my set-up. All the bestRic Quote Link to comment Share on other sites More sharing options...
Shelly300 Posted February 12, 2009 Author Report Share Posted February 12, 2009 Thank you for your reply Ric this simple code is the contents of a file called helloworld.php <html><head><title>My First PHP Page</title></head><body><?phpecho "Hello World!";?></body></html> Thanks Quote Link to comment Share on other sites More sharing options...
Ric Posted February 12, 2009 Report Share Posted February 12, 2009 There is nothing wrong with your code it should run with no problems. The three browsers are doing something different suggesting that the page is not being processed by PHP! They are treating the page as a standard file, are you directly opening the file from your browsers because that would explain your observations. If your browser address bar is displaying something like file:///W/test.phpThen you opened it directly bypassing the server. If you typed in http://localhost/test.php a browser is expecting the page to be served. Trouble is you have had the server working “and have been using it successfully without a drama” hence the above is clearly not the problem. I can’t think of anything else to explain the different browser responses. All the bestRic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.