Jump to content
Killersites Forums

PHP Print Command won't display text when opened thru WAMP Projects


Recommended Posts

I just stumbled onto your videos today and am crankin away on them.


I installed WAMP and moved on to the "Hello World" video. I got the wamp.www.phpTest file (my file that corrosponds to your php_work file) to show up in my WAMP "Your Projects", but when I click the project file it takes me to the "Index of /phpTest" that lists the page as index.php.htm . When I view the index.php.htm page in explorer, it only shows blank white. If I go to view source, all the code is in place on the page, but the "Hello World" text doesn't show in the browser window.


I created a blank web page in Visual Web Developer 2008 and just saved it into the WAMP.WWW file from there. All the code is exactly as you had it in your video. Do you have insight? If so will you share?




Link to comment
Share on other sites

The first thing to check: your files need to be named like this: filename.php. From your description, it seems like your file is named "index.php.htm". If it has that .htm ending, the PHP server doesn't know to process it as PHP.


You may need to follow these instructions, in case Windows is hiding the default file extensions from you:

-- open up a Windows Explorer window

-- Click "Tools" then "Folder Options"

-- Click the "View" tab

-- make sure that the "Hide extensions for known file types" checkbox is unchecked.

Link to comment
Share on other sites

Thanks for the quick response. Sorry for my ignorance.


I changed the hidden file extention setting as you suggested, but after reading your post it became clear that my computer automatically sticks the html extension on the end of my file if I try to save the web page from either VWD 08 or from notepad.


In notepad the default file type is .txt and the default Encoding is ANSI.

If I change the Encoding to Unicode and leave the file type as .txt, it automatically puts a .txt extension after the .php instead of a .html.

If I change the file extension to AllFiles instead of .txt and then change the encoding to Unicode, it will save the file with a .php extension, but the system will not recognize which program created it. The icon becomes that generic image and apache still opens a blank page within which the source view still shows all the correct code as text.


Actually, there was a c:\wamp.index.php file by default when I installed wamp, and that file is not recognized by my computer either. It has the same generic icon that I described above.


I think I'm dumb, but it appears that I don't know how to save a .php file, or else to configure my system to recognize one, or something... Go ahead an laugh, but what am I not doing?


Thanks again,


Link to comment
Share on other sites

You should be able to save as php using Notepad...


-- Save As

-- enter "filename.php" for the filename, and leave "Save as type" along -- it should default to .txt. That is fine.

-- If, after all of that, your computer still somehow includes a .txt in the file ending, you can edit the file name (right click on the file, Rename) yourself.


By default, your computer may not know what program to use to open a .php file. That is fine and normal, and it won't necessarily change icons. If that is the case, you should be able to right click on a .php file, choose "Open with" from the menu, and then "Choose Program". Once you have selected the type of program you want to use to open that file, in the same dialog box there should be a checkbox that allows you to always open that type of file with the selected program.


You may know this already, but I always say it anyway... Remember that to preview a .PHP file, you can't simply double click on the file. You need to place it in the correct location (I believe it is the "www" directory) and you have to look at the file by using localhost (make sure that the server is on, then go to "http://localhost" in your browser).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...