[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 463
  • Last Modified:

Editing PHP Files in DreamWeaverMX

Hello EE,
I've finally decided to ask this question here after almost a dozen failed attempts, the last one being over two years ago.  I've had to edit PHP files on my server for the past few years, because I could never get DreamWeaver setup properly to edit PHP files.  By this, I mean DreamWeaver WILL bring up the PHP file in the editor.  But to view the results of the edit, I would have to upload the page back to the server and call it from there.

Here's what I've tried in the past (in general terms):
1)  downloaded a few of those "Apache / MySQL / PHP" all-in-one "one-click-guaranteed-to-work" scripts from a few sources on the web.  Result:  More than one click, still didn't work (always a problem recognizing of finding the mySQL server).

2)  Installed separate Apache, mySQL and PHP servers.  Result:  couldn't seem to get them to communicate with each other

Don't know if this is helpful, but here's my local environment:

Processor:  Intel(R) Pentium(R) 4 CPU 1.60GHz
Memory:  (RAM) 768 MB
OS:  Microsoft Windows XP Home Edition
HD:  20 GB

This is what I have on my server:

apache (1.3.28 (Unix)
RedHat 9 i686
PHP version 4.3.2
MySQL version 4.0.22-standard
PERL version 5.8.1

Can anyone outline, in vivid detail - step 1, step 2, step 3 etc., the method for editing and then viewing edited PHP file results in DreamWeaver MX?

If possible, I prefer answers like this:

1)  download apache server for windows from apache.org
2)  download PHP from php.net
3)  download mySQL for windows from ? and to ?
4)  install apache server  [in default apache directory ? or somewhere better suited for use with DreamWeaver?]
5)  install PHP server   [in suggested default PHP directory ? or somewhere better suited for use with DreamWeaver?]
6)  install mySQL server [in suggested default mySQL directory ? or somewhere better suited for use with DreamWeaver?]
7)  configure DreamWeaver MX as an application server by doing this :  ?

In the past, I've installed Apache 1.3 and it worked with no problem.  I've installed PHP4 but couldn't get it working without the connection to mySQL, which, even after installing, never worked properly.

If you are not an expert with this subject, but still want to contribute, I understand that's part of what EE is all about.  But please don't supply answers here that ask me "If I've tried this or tried that", and please don't supply answers with "if you try this, it might work".  I'm working on a computer now that has a completely clean slate - no Apache server, no PHP server, and no mySQL server.  I don't want to gum it up with a bunch of experiments.  I'd rather have an exact, detailed answer to this question or no answer at all.  If I read answers that aren't specific and obviously expert in nature, I won't even acknowledge them.  Don't mean to sound rude, just don't have time to be somebody's tester.

Best regards,
The-Muse

0
the-muse
Asked:
the-muse
  • 2
  • 2
1 Solution
 
oneride21Commented:
I use DW MX 2004 and code in PHP everyday...the only way I have been able to preview the php file actually working is to setup a testing server from within the site properties in DW, and set the preferences to automatically uploade the file to my testing server when I save it.

For example, I will create  a new site in DW and setup the sftp connection to the live server, then I will setup the testing server on the live server as well, just in a different directory until I am ready for it to go live. In my opinion it is much easier and more secure to do it this way than to setup your local computer with Apache, mysql, php4...etc. I do also have a server setup in-house with similar settings, but I rarely use it...cause the above is easiest for me and keeps everything in one place on the server I am working on.

This is probably not what you were wanting for an answer...but at least I didn't tell you to go try this or try that...the above is what works for me without me having to spend a ton of time doing things myself (like setting up and configuring my own server 20 times).

If you want step by step instructions for the above, let me know...I will be happy to write them for you. Otherwise, I am assuming you may already be somewhat, if not very, familiar with creating and using Sites in DW.

Good luck!
0
 
the-museAuthor Commented:
Hi oneride21,

If I understand your suggestion correctly, it sounds like an excellent idea.  After searching for the past several hours on the web, I didn't run across that solution anywhere.

Do I understand you correctly that I should be able to open a new site in DreamWeaver, configure DreamWeaver as the sftp client to my server, setup the testing server in a different directory on my server, then edit the php files in DreamWeaver with the results of the edits immediately available in the DreamWeaver GUI?

If so, I would only have a couple of questions, because my attempts to use DreamWeaver server behaviors in the past have failed due to complications with apache, mySQL and php communicating with each other.  

I'll explain what I am attempting to accomplish, which may be somewhat different from what you have done:

1)  I am not creating scripts, I am editing pre-existing scripts, already setup with mySQL databases on my server, and configured (usually through "configure.php") with various server variables.  My edits normally consist of modifying the html coding to change the generic cookie-cutter look of the scripts (PHP List is one of the scripts).

2)  The way I've been doing it so far is using WinSCP to login to the specific account on my server, then opening an editor native to the SFTP client, searching through a haystack of php code to find a needle of html code, modifying the html code, saving the php file, then calling the page in the browser to check my design change.  If I'm not satisfied with the design change, it's back to the haystack for another try.

Since I've been using DreamWeaver for years, but never successfully with server behaviors, I was thinking how nice it would be if I could edit the html in the php pages and view the results immediately within the DreamWeaver GUI.  

If, after explaining what I am trying to do, you still think your procedure would work, I believe I would only need the answers to a couple of questions.

<<For example, I will create  a new site in DW and setup the sftp connection to the live server>>
** That seems straightforward enough.  Just use DreamWeaver's ftp utility to login to the public_html directory of the domain to be modified on the server, yes?
--------------
<<then I will setup the testing server on the live server as well, just in a different directory>>
**  Could you explain this part in a bit more detail?  Does this mean to upload the pages I want to modify to a different directory on the server, then inform DreamWeaver to consider that directory the testing server?

I've never used DreamWeaver as an FTP client, using instead, the secure:
WinSCP
http://winscp.net/eng/index.php
Freeware SFTP and SCP client for Windows

But it's editor is not at all graphical in nature.

Best wishes,
The-Muse
0
 
oneride21Commented:
Not quite sure where to start here....

First of all...please be aware that as far as I know there is not a way for you to preview your dynamic .php files from within the DW GUI simply because it will not parse the php code. However, DW is a very good tool to use when in code veiw and split view so you can find pieces of code to edit allot easier. Given this, I will explain exactly what it is I wsa suggesting earlier.

First, let me answera couple questions:

"<<For example, I will create  a new site in DW and setup the sftp connection to the live server>>
** That seems straightforward enough.  Just use DreamWeaver's ftp utility to login to the public_html directory of the domain to be modified on the server, yes?"
---Yes. That is right. DW MX 2004 has SFTP built. This is nice...as long as the server you are working on allows SFTP connections...which it should.

"<<then I will setup the testing server on the live server as well, just in a different directory>>
**  Could you explain this part in a bit more detail?  Does this mean to upload the pages I want to modify to a different directory on the server, then inform DreamWeaver to consider that directory the testing server?"
---Basically yes. In the site properties for the testing server, you will specify a different directory or folder. For example, public_html/test. What you do now is open your php file in DW and under the Files window (F8), choose the Testing Server View and then click connect. Once connected you can make your changes and upload the file. Doing so will upload the file to the testing server/folder. All you do now is open your browser and point to that file in the test directory and see your changes. Once you are happy with the changes, disconnect from the testing server and connect to the live server and do your upload...all in DW.

By the way, as I mentioned earlier, you can setup the site so that when you save the file you are editing...DW will automatically upload it for you depending on the which connection you have established.

Let me answer this one a bit differently:
<<Do I understand you correctly that I should be able to open a new site in DreamWeaver, configure DreamWeaver as the sftp client to my server, setup the testing server in a different directory on my server, then edit the php files in DreamWeaver with the results of the edits immediately available in the DreamWeaver GUI?>>
--- Yes...except for being able to view the edits/results immediately in DW GUI.

After making your edits, upload the file(s) to the testing server and then preview your changes in a browser. I always keep a browser open next to DW with the page I will be updating opened in it...then when I make my changes in DW and save the file, DW automatically uploads it to my test server so all I have to do is Alt+Tab to the browser and refresh to see the changes.

One other thing I love about DW is the search and replace feature. It is very powerfull when trying to locate bits of code to edit and my favorite is when I have to make the same change to multiple files...it can do that for me. Not to get off the subject. :)

As far as working on Mysql or database stuff...DW can also connect to a database and make it easier to modify or edit it...however, I havn't set my self up to using DW as my database manager so I can't help you with that piece. I mainly use DW simply for all my php, html, css, and javascript files/coding. I use PuTTy or phpmyadmin for the mysql stuff I do.

I hope this eplains it all better...if not, please let me know what you need more clarification on and I will do better.

Thanks!
Oneride21
0
 
the-museAuthor Commented:
Hi oneride21,

Thanks for the explanations.

<<First of all...please be aware that as far as I know there is not a way for you to preview your dynamic .php files from within the DW GUI simply because it will not parse the php code.>>
**  Yes, so it seems.  One of these days I'll wager that MacroMedia will incorporate this function withing the DMX interface.

I presently own two linux web servers on which I host my design clients (most of them).  The method I've been using to edit the html coding within the php pages (described earlier in this post) is essentially the same method you describe in your suggested alternative.  In actual practice, my method is a bit less time consuming (not much).  I already have the sites up, the mySQL databases setup and the latest PHP running on the servers.  The unappealing aspect of editing php using my method is having to deal with the native editor included with the SFTP client.  It's like the difference between coding html with notepad, or using instead DMX.  I learned on notepad, which was great for learning.  But DMX adds the visual enjoyment and instant gratification I have long since become used to.

So, comparing my steps with yours, I'm essentially doing the same thing, except using the SFTP editor to modify the html code.  The steps in my case are:  

1)  Open the browser to the page intended for modification
2)  Login via SFTP to the directory containing the php files
3)  Select the desired file, right click and select "edit"
4)  When finished editing, click save (this does not close the editor, which is handy if I need to get right back into it)
5)  Refresh the browser to see the results

You have answered the essence of my question.  I will, at this time, discontinue my search for ways to view the results of an edited php page within the DMX GUI..

Some interesting thoughts on the subject (you may find too basic to appreciate, but just in case):
1)  http://codewalkers.com/archives/phphelp/249.html
2)  http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_videos.html
3)  http://www.interaktonline.com/
4)  http://www.oreillynet.com/pub/a/javascript/2003/02/07/dreamweaver.html

To condense everything I've learned from your suggestions, and from several hours of reading today at various php websites featuring DMX / PHP tutorials, I believe your post has answered the nagging questions I have had over the past couple of years as well as can be expected.  My goal is not achievable at this time as I had hoped it might be.  Part of the reason is my own lack of experience with mySQL.  The rest is reading your one simple phrase "because it will not parse the php code".

Thank you for sending me in a direction where I can best use my time.

Best wishes,

The-Muse

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now