5 Replies Latest reply: Jul 7, 2012 11:32 AM by Nancy O. RSS

    Connecting PHP to an existing site in DW

    nevitt99 Community Member

      How do I connect PHP to a existing site. I've been using MS Expressions for my PHP? I would like to use Dreamweaver CS5 to write PHP to an existing site. Dreamweaver had a message saying it could find the correct server.

        • 1. Re: Connecting PHP to an existing site in DW
          Nancy O. MVP

          "Setting up a PHP Environment in Dreamweaver"

          http://www.adobe.com/devnet/dreamweaver/articles/setup_php.html

           

           

           

          Nancy O.

          • 2. Re: Connecting PHP to an existing site in DW
            nevitt99 Community Member

            That's the tutorial I've been using. PHP works when I use Expression Web, but not with Dreamweaver.

             

            Do I need to connect the PHP like CSS?

            • 3. Re: Connecting PHP to an existing site in DW
              Nancy O. MVP

              PHP is a server-side programming language used in scripts and dynamic web pages.  You need a server to parse PHP pages locally.  Do you have a local testing server installed and defined in DW yet?

              PHP works when I use Expression Web, but not with Dreamweaver.

              What does "works" mean?  What happens when you open a page in MS EW that isn't happening when you use DW?  Are you getting error messages?  What do you see in Code View?

              Do I need to connect the PHP like CSS?

              Huh?  Can you show us your code?

               

               

              Nancy O.

              • 4. Re: Connecting PHP to an existing site in DW
                nevitt99 Community Member

                <!DOCTYPE HTML>

                <html>

                <head>

                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

                <title>About Me</title>

                <link href="portfolio.css" rel="stylesheet" type="text/css" media="all">

                </head>

                 

                <body>

                <div id="wrapper">

                <div id="menu">

                <ul class="nav">

                <li><a href="index.html">Home</a></li>

                <li><a href="aboutme.html">About Me</a></li>

                <li><a href="resume.html">Resume</a></li>

                <li><a href="portfolio.html">Portfolio</a>

                    <ul>

                    <li><a href="websites.html">Websites</a></li>

                    <li><a href="programming.html">Programming</a></li>

                    <li><a href="graphics.html">Graphics</a></li>

                    </ul>

                </li>

                <li><a href="contact.html">Contact</a></li>

                </ul>

                </div>

                <div id="banner"><img src="image/bannertext2.png" alt="N99design" title="N99design"/></div>

                <div id="container">

                <div id="content">

                <!--PHP-->

                <?php

                $fp = fopen("aboutme.txt", "r");

                 

                $line = fgets($fp)){

                print <p>$line</div>\n";

                 

                while(!feof($fp)){

                $line = fgets($fp);

                print "$line <br />\n";

                }

                fclose($fp);

                ?>

                 

                </div><!--End content-->

                </div><!--End container-->

                </div><!--End wrapper-->

                </body>

                </html

                What I mean by works in MS EW is it runs on the local server and everything works as its supposed to.

                How do I set up a local server on a existing site?  When I test the page in PHP that I know works is MS EW I get an error message that says it can't find the server.

                • 5. Re: Connecting PHP to an existing site in DW
                  Nancy O. MVP

                  Did you define your local testing server in DW? 

                       Site > Manage Sites > Edit...

                   

                  Screenshots below are for WAMP server on C drive:

                   

                  http://forums.adobe.com/servlet/JiveServlet/showImage/2-4541063-210490/CS6-testingServer1.jpg

                   

                  Under Advanced tab:

                   

                  http://www.adobe.com/content/dotcom/en/devnet/dreamweaver/articles/setup_php/_jcr_content/articlecontentAdobe/image_12.adimg.mw.450.jpg/1279007071618.jpg

                  Hit Save.

                   

                  Final screen should look like this:

                   

                  http://forums.adobe.com/servlet/JiveServlet/showImage/2-4541063-210489/CS6-testingServerFinalScreen.jpg

                  Finally, make sure your testing server is Online.

                   

                  http://forums.adobe.com/servlet/JiveServlet/showImage/2-4540341-210434/WAMP-taskbar-online.jpg

                   

                   

                  Nancy O.