Skip to main content
Known Participant
September 3, 2009
Question

PHP code file doesn't work in Dreamweaver, but does on web server

  • September 3, 2009
  • 1 reply
  • 5472 views

Although I've been a programmer/systems analyst for 50 years, I'm new to web programming; I guess this makes me a dinosaur.  Anyway, I've been learning PHP/MySQL and Dreamweaver, and have encountered a strange issue.  I created a small (test) web page with a two field form (i.e. Name and Messagel) and a "Go" button which calls a small php file (i.e. action="helloworld.php" method="post").  The php file simply collects the two fields and "echo"s them to the screen.  When I try to execute the form in Dreamweaver, using the "Live View" button, nothing happens.  When I use the "Preview/debug in Browser" button the page opens in the (IE7) browser, but when the Go button is pressed, the Dreamweaver item in my taskbar starts blinking.  When I then switch back to Dreamweaver, the php file has been placed in the workspace, and the cursor is located at the very start of the code (ie @ the "<?php).

Now here's the strange part (at least to me), If I publish the two files to my web server (index.html & helloworld.php)  IT WORKS.  I can enter data into the two fields, press the Go button, and the php code echoes the information on the screen.  Can anyone tell me what I must be doing wrong to cause this?

This topic has been closed for replies.

1 reply

DwFAQ
Participating Frequently
September 3, 2009

Setup a local testing server to view dynamic pages locally.

Known Participant
September 3, 2009

I've tried to do that, but the dialogs are very confusing and couldn't get it set up.

I do have a ZAMPP installation using Apache on my local computer, and the pages work there, but for each time I want to test, it's a real pain to:

     1)  Close Dreamweaver (if I leave it open I get griev)

     2)  Copy the files to XAMPP's htdoc folder

     3)  Open a browser window

     4)  Type in "HTTP://localhost/index.html

     5)  Check out the program

     6)  Go back to Dreamweaver for more work.

I could certainly use some help there.

DwFAQ
Participating Frequently
September 3, 2009

Heya,

Look into setting up your virtual host so that you do not need to copy files from Dreamweaver site location to XAMPP's htdoc folder as you've mentioned in step 2.

With virtual hosts setup you can leave the site files in the original location that you've setup in Dreamweaver and enter site1, site2, etc. in browser to preview without copying the files to XAMPP's htdoc folder. Your Live View should also function correctly in Dreamweaver after you have properly setup virtual hosts to point to location of files in Dreamweaver.

Your current problem is that local testing server is looking for site files in XAMPP's htdoc folder whereas Dreamweaver is looking for them in a different location (which is not setup for local testing server via virtual host). As a result you can not view dynamic pages in Dreamweaver site location. Setup virtual host to point to Dreamweaver site location in order to view dynamic pages via Live View. Remember to restart Apache after making changes to virtual hosts in order for the changes to take effect.

Hope that helps.