johne281 Posted June 30, 2009 Share Posted June 30, 2009 Hi I am using WAMP, Firefox, and Notepad++ to learn php. My problem is that the server has trouble displaying the code I am typing sometimes. I am following some video tutorials and I have used the following bits of code. <html> <head> <title>Hello World</title> </head> <body> <?php echo "Hello World!"; ?> <br/> </body> </html> <html> <head> <title>Variables</title> </head> <body> <?php $var1 = 10; echo $var1; ?> </body> </html> They work fine sometimes and other times it displays a blank document with the correct title for the page. What would cause this issue. The issue started with the first bit of code. I turned WAMP off and then I turned it back on and it started working fine. What could be the cause? Please help. Quote Link to comment Share on other sites More sharing options...
johne281 Posted June 30, 2009 Author Share Posted June 30, 2009 Ok I realized that it is just not diplaying .php files correctly. I created a basic .html file and it is displaying just fine. but the rest of my (extremely simple) .php files are displaying a blank page. The title does appear at the top of the browser so I know it is at least recognizing the files. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 30, 2009 Share Posted June 30, 2009 Make sure you're saving your code within .php files. You should also be saving these files within WAMP's www folder (C:/wamp/www). To run your php files you need to be going to http://localhost Do not try to open your .php files from windows explorer (Rigth click > Open With) or by going to File > Open in your browser. This is not the same as going to http://localhost Also ensure you are using full PHP tags (<?php ?>) and not short tags (<? ?> or <?= ?>). By default short tags are disabled. To enable short tags left click wamp tray icon and select PHP > PHP Settings > short open tag. 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.