Code2Design.com

User login

The Layout

Programming

Graphic Design

Resources

Navigation

C2D Projects

Unsystematic Affiliates

Tutorial Index Source Crave Tarnic Open Web Design 

Change Language

Who's online

There are currently 0 users and 4 guests online.

PHP Newbie - Printing what I write?

I know HTML. I have used Dreamweaver to build my sites. I know some Flash. I want to learn PHP. I downloaded EasyPHP. I watched your video for Lesson 1. Perfectly understandable. I don't understand how to save and test/print what I've written. I saved as you suggested but the PHP file gets saved or rather shows up as a Dreamweaver icon. The file automatically opens in Dreamweaver. When I try to preview in browser (F12) it asks me for a test server. How do I set this up? I've tried saving the file to one of my websites, but I don't think Dreamweaver is reading the code correctly. I get an error message that I haven't uploaded the file correctly to the web site. Does this make sense? I'm able to write PHP code but have no way of testing or checking what I've written. I'm working with Windows XP. Thanks in advance for your help.

Leslie Cherrington


Submitted by colorjunkie on December 1, 2007 - 12:47am.
printer friendly version

File types, PHP, and Localhost

Well, it sounds like you are just having some simple trouble with the "localhost" part of easyPHP.

First about that dreamweaver icon. In windows every file type (.ico, .php, .doc) is associated with a program that windows will call when the user clicks on that file type. For example, on a Windows machine (in most cases) the ext ".doc" is set in the registry to call a program called "Microsoft Word" when someone clicks on that file. However, if you right-click on that file you could change the "file type" setting for that file to have Microsoft Paint, Firefox, or Notepad open it! (Wither those programs could actually read the file is a different matter).

At the same time you can also open that file from any other program - wither that program is set to open that file or not! Just open up some application and click "File>Open>* All documents".

If you want to try this out create a new "test.txt" file. You should see some simple textpad icon or something. Then right-click on it and select "Properties" then click the "Opens with" button and you will see that you can make Windows Media Player open .txt files if you want!

So, the icon really has nothing to do with the file. It is just Windows way of telling you what program it will load if you click that file.

As for your problem now ;)

Don't try to "double-click" to open a PHP file - It doesn't work like that. .php, .asp, etc.. are different from most files in that you have to have a server running that will process it thought the PHP core. You have two choices 1) configure dreamweaver with the easyPHP server. 2) You will have to access your file through the web browser. I pick 2) as I am not familiar with the dreamweaver software. ;)

If you start EastPHP you will see that there is an icon in the lower-right of your screen. Click it to open a menu and you can access the easyPHP root. OR with easyPHP running, open your browser type "localhost" in the address bar to go to your easyPHP root directory (which should be "www" or something). You should then see the easyPHP home page.

make sure you save the file you want to run in the easyPHP directory. You can't save it to your desktop or my documents.

The path should be something like C:/easyphp/www/myfile.php

Hope this helps!


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <br /> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use BBCode tags in the text, URLs will be automatically converted to links
More information about formatting options



Like what you see?

Why not add more? C2D is looking for other Christian Web Masters who would like to help write articles for this site. If you have expericance in FLASH, CSS/HTML, PHP/MySQL, PhotoShop/GIMP, Blender, Javascript, or just General Design - our users would love to hear what you have to say. Contact Us

delicious   digg   reddit   magnoliacom   newsvine   furl   google   yahoo   technorati