16 Replies Latest reply on Jul 28, 2007 9:08 PM by oboemuse@msn.com

    MySQL / PHP / Dreamweaver connection

    oboemuse@msn.com
      I inadvertently posted this identical message in the Dreamweaver Extensions forum. I think it really belongs here. Thanks.

      I'm using
      Dreamweaver MX 2004,
      I have installed php 5.2.3,
      Apache 2.2.4,
      I have MySQL Server Version 5.0.41 community nt via TCP/IP
      client version 5.1.1
      (And now having typed that I wonder if there's some setup wrong right there..)

      I've changed my php.ini file to load the extensions, inluded the ext folder in the extension_dir directive, changed my apache config file to load the modules, my php.info shows both mysql and mysqli on the localhost, but anytime I try to get dreamweaver to see a MySQL database, I get "an unidentified error has occurred". I think I've set up the site information correctly, and I'm using "localhost" and "root" for my database connection.

      Since I've read about a hundred and more articles from as many sources regarding Apache, PHP, Dreamweaver, MySQL I'm still no nearer figuring out what is wrong.
      Advice? Thanks for any help!
        • 1. Re: MySQL / PHP / Dreamweaver connection
          Level 7
          Two Oaks Jerseys wrote:
          > my php.info shows both mysql and mysqli on the localhost, but
          anytime I try to
          > get dreamweaver to see a MySQL database, I get "an unidentified error has
          > occurred". I think I've set up the site information correctly,

          With that setup, you also need to enable mbstring.

          The site definition is usually the cause of "unidentified error". In the
          Testing server category, Testing server folder and URL prefix need to
          point to your site root. Testing server folder is the physical path to
          the site root; URL prefix is the URL you would use to get to the same
          location. For example:

          Testing server folder: C:\htdocs\mysite\
          URL prefix: http://localhost/mysite/

          --
          David Powers, Adobe Community Expert
          Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
          Author, "PHP Solutions" (friends of ED)
          http://foundationphp.com/
          • 2. Re: MySQL / PHP / Dreamweaver connection
            oboemuse@msn.com Level 1
            Thank you for your help.
            Yes, I've enabled the mbstring as well in the php.ini.
            I have the testing server set up just like you say with the Testing server folder =
            C:\.....\htdocs\mysite\
            URL prefix: http://localhost/mysite/

            I've just written a little script (in notepad) to determine MySql connects:

            <?php
            mysql_connect("localhost", "root") or die(mysql_error());
            echo "Connection OK"; ?>

            And I get "Connection OK" in a browser.
            The script is not using a password, but when I try to connect in Dreamweaver without a password, I get a prompt to enter a password. Also, mySQL admin tool (MySQL Administrator) requires a password, so I'm pretty confused there.

            • 3. Re: MySQL / PHP / Dreamweaver connection
              Level 7
              Two Oaks Jerseys wrote:
              > The script is not using a password, but when I try to connect in Dreamweaver
              > without a password, I get a prompt to enter a password. Also, mySQL admin tool
              > (MySQL Administrator) requires a password, so I'm pretty confused there.

              1. You should not use the root account to connect to MySQL from Dreamweaver.
              2. You should not leave the root account without a password.

              If you're using MySQL on Windows, you should use the MySQL server
              configuration wizard to create a password for the root user. You should
              also establish at least one user account with more limited privileges
              and a password to use in your DW projects.

              --
              David Powers, Adobe Community Expert
              Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
              Author, "PHP Solutions" (friends of ED)
              http://foundationphp.com/
              • 4. Re: MySQL / PHP / Dreamweaver connection
                oboemuse@msn.com Level 1
                I'm still getting a prompt for a password when I try to set up a connection in Dreamweaver.

                I went to the MYSQL Administrator, created a user with no password, could sign into the administrator with no password. I thought that the administrator and mysql database would be the same. I didn't think I had left the root user without a password, and the administrator won't let me sign in without that password, and yet, the script I showed you seems to render a successful connection. arghh..
                • 5. Re: MySQL / PHP / Dreamweaver connection
                  oboemuse@msn.com Level 1
                  >1. You should not use the root account to connect to MySQL from Dreamweaver.
                  >2. You should not leave the root account without a password.

                  >If you're using MySQL on Windows, you should use the MySQL server
                  >configuration wizard to create a password for the root user.
                  I re-ran the configuration wizard to set the password (same password as before) but now at least I get this response from my browser:
                  "Access denied for user 'root'@'localhost' (using password: NO)"

                  >You should also establish at least one user account with more limited privileges and a password to use in your DW >projects.
                  I have created a user and a password, but I still can't get dreamweaver to recognize the connection.
                  • 6. Re: MySQL / PHP / Dreamweaver connection
                    Level 7
                    Two Oaks Jerseys wrote:
                    > I have created a user and a password, but I still can't get dreamweaver to
                    > recognize the connection.

                    First, establish that you can connect successfully to MySQL using either
                    the MySQL Command Line Client or MySQL Query Browser. If you can do
                    that, but cannot connect from Dreamweaver, it means that your
                    Dreamweaver testing server definition is wrong.

                    --
                    David Powers, Adobe Community Expert
                    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                    Author, "PHP Solutions" (friends of ED)
                    http://foundationphp.com/
                    • 7. Re: MySQL / PHP / Dreamweaver connection
                      oboemuse@msn.com Level 1
                      It seems that I can make a connection to the database with both the query browser and a command line. You say that it means the settings in Dreamweaver are wrong; I can't imagine what else to do.

                      These are the settings:
                      Local Info:
                      Site name: AnotherSite
                      Local root folder: c:\mydocs\AnotherSite
                      Default images folder: c:\mydocs\AnotherSite\images
                      http://localhost/AnotherSite/


                      Remote Info:
                      Access: Local/Network
                      Remote folder: C:\Program Files\Apache.....\htdocs\AnotherSite\

                      Testing Server:
                      Server Model: PHP MySQL
                      Access: Local/Network
                      Testing Server Folder: C:\Program Files\Apache.....\htdocs\AnotherSite\

                      URL prefix: http://localhost/AnotherSite/
                      • 8. Re: MySQL / PHP / Dreamweaver connection
                        Level 7
                        Two Oaks Jerseys wrote:
                        > These are the settings:
                        > Local Info:
                        > Site name: AnotherSite
                        > Local root folder: c:\mydocs\AnotherSite
                        > Default images folder: c:\mydocs\AnotherSite\images
                        > http://localhost/AnotherSite/

                        When testing a site locally, it's normal to put the local root folder in
                        the server root. However, this setup should be OK. It's just rather
                        wasteful, because it means Dreamweaver needs to copy each file to the
                        server root for testing.

                        > Remote Info:
                        > Access: Local/Network
                        > Remote folder: C:\Program Files\Apache.....\htdocs\AnotherSite\

                        Remote info is for your remote server, not for your local testing
                        server. I don't know if it's causing any problems, but I suggest that
                        you reset this to Access: None.

                        > Testing Server:
                        > Server Model: PHP MySQL
                        > Access: Local/Network
                        > Testing Server Folder: C:\Program Files\Apache.....\htdocs\AnotherSite\
                        >
                        > URL prefix: http://localhost/AnotherSite/

                        This looks OK. You say that you're using MX 2004. Have you installed the
                        MX 2004 updater? You can tell whether it's installed by checking the
                        version number when the program launches (it should be 7.0.1). You can
                        also check the version number by going to Help > About. If you're using
                        7.0.0, go here to download the updater:

                        http://www.adobe.com/support/dreamweaver/downloads_updaters.html#dwmx2004

                        After installing the updater if necessary, go to the Site menu in the
                        main menu bar in Dreamweaver, and select Advanced > Remove Connection
                        Scripts. Then try to create a new MySQL connection.

                        The way that Dreamweaver communicates with MySQL is through a hidden
                        folder called _MMServerScripts that is placed in the root level of the
                        site. You can't see it in the Files panel, but you should be able to
                        check its presence in Windows Explorer. In your setup, it should be here:

                        C:\Program Files\Apache.....\htdocs\AnotherSite\_MMServerScripts\

                        If it's missing or contains old versions of the connection scripts, you
                        can't communicate with MySQL.

                        --
                        David Powers, Adobe Community Expert
                        Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                        Author, "PHP Solutions" (friends of ED)
                        http://foundationphp.com/
                        • 9. Re: MySQL / PHP / Dreamweaver connection
                          Robo-X
                          I might be wrong but didn't MySQL change the way the passwords are encrypted in version 5? If Dreamweaver is trying to connect to the MySQL database it might use the old encryption and fail. Try changing the encryption to the old way and check if it works in DW. Or try the DW CS3 Trial and see if they have fixed this problem in DW9.

                          //Rob
                          • 10. Re: MySQL / PHP / Dreamweaver connection
                            Level 7
                            Robo-X wrote:
                            > I might be wrong but didn't MySQL change the way the passwords are encrypted in
                            > version 5? If Dreamweaver is trying to connect to the MySQL database it might
                            > use the old encryption and fail.

                            Password encryption was changed in MySQL 4.1. However, the encryption
                            method isn't handled by Dreamweaver. It's dependent on the libmysql
                            dynamic library installed with PHP. Since the OP has client version
                            5.1.1, passwords shouldn't be a problem.

                            http://dev.mysql.com/doc/refman/5.0/en/old-client.html

                            However, the problem might lie in using the 5.1.1 client version with
                            MySQL 5.0.

                            --
                            David Powers, Adobe Community Expert
                            Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                            Author, "PHP Solutions" (friends of ED)
                            http://foundationphp.com/
                            • 11. Re: MySQL / PHP / Dreamweaver connection
                              oboemuse@msn.com Level 1
                              David, thank you so much for your good help.
                              I ran the update to mx 2004 and re-configured the settings for remote (to show none).

                              I do have a little bit of a mystery.

                              Although I am able to write a SQL statement to retrieve the information that I want from the MySQL database and see that information in a browser (at last), I see no tables (views, stored procedures) from the Dreamweaver databases tab. I guess in once sense, as long as I can write a correct SQL statement, Dreamweaver will do a fine job of rendering the information I'm looking for in the webpage. On the other hand, not being able to see the tables, etc. will hinder the usefulness of that database tab, and I'll have to keep eyeballing MySQL database to make sure of what I'm choosing. I think I'll try to create an entirely new site with the suggested configurations and see if I get any different result.

                              I really appreciate all the help you've offered!
                              • 12. Re: MySQL / PHP / Dreamweaver connection
                                Level 7
                                Two Oaks Jerseys wrote:
                                > Although I am able to write a SQL statement to retrieve the information that
                                > I want from the MySQL database and see that information in a browser (at last),
                                > I see no tables (views, stored procedures) from the Dreamweaver databases tab.

                                It's possible that your site still has the old connection scripts. Go to
                                the main Site menu, select the Advanced submenu at the bottom, and click
                                Remove Connection Scripts.

                                --
                                David Powers, Adobe Community Expert
                                Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                                Author, "PHP Solutions" (friends of ED)
                                http://foundationphp.com/
                                • 13. Re: MySQL / PHP / Dreamweaver connection
                                  oboemuse@msn.com Level 1
                                  David, I'm the same person who started this topic. For some reason I can't seem to sign in with the Two Oaks Jerseys nickname any more. Oh, well.

                                  >It's possible that your site still has the old connection scripts. Go to
                                  >the main Site menu, select the Advanced submenu at the bottom, and click
                                  >Remove Connection Scripts.

                                  I did go to SITE / remove connection scripts. Tried a new connection, but alas! still cannot see any tables inside of dreamweaver.
                                  To reiterate: I AM seeing the data from mySQL database rendered correctly in a browser. I even could do VIEW, LIVE DATA and see it inside the design view in dreamweaver. Even at that, it would not show me anything about the tables or recordset. I had to write that statement and place it in the code.

                                  I have looked for the _MMServerScripts. I have one for every website. You said if they were old they wouldn't work? Is this something that Dreamweaver writes ? If I actually delete the folder and try to make another connection (as I have about a hundred times now) will it write it correctly? That doesn't seem to be the case.

                                  I went through the article that you had mentioned ( http://foundationphp.com/tutorials/php_installer.php )
                                  and it seems I've done everything I should do. It's obvious that mySQL, php, and apache are all running together; they are just not being seen from inside the Dreamweaver environment.

                                  If you have any more ideas, I'm listening. I know that Dreamweaver's ability to connect to mySQL, write a query and a record set would make this work SO much easier; It's pretty tedious to make sure that those select statements are perfectlly accurate and I can see some data.

                                  If there are any files, configs, ini, pictures, or any other thing that I can send to illucidate this any further, please let me know.

                                  Thanks for ANY suggestions.
                                  • 14. Re: MySQL / PHP / Dreamweaver connection
                                    Level 7
                                    oboemuse@msn.com wrote:
                                    > I have looked for the _MMServerScripts. I have one for every website. You said
                                    > if they were old they wouldn't work? Is this something that Dreamweaver writes
                                    > ? If I actually delete the folder and try to make another connection (as I have
                                    > about a hundred times now) will it write it correctly? That doesn't seem to be
                                    > the case.

                                    _MMServerScripts is created by Dreamweaver, and if you have the correct
                                    settings for testing server in the site definition, it should create the
                                    folder in the site root. If you're still not able to connect to MySQL
                                    through Dreamweaver, try turning off any software firewall. It may be
                                    preventing communication between DW and MySQL. If that works, you need
                                    to reconfigure the firewall to permit communication between the two
                                    programs.

                                    --
                                    David Powers, Adobe Community Expert
                                    Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
                                    Author, "PHP Solutions" (friends of ED)
                                    http://foundationphp.com/
                                    • 15. Re: MySQL / PHP / Dreamweaver connection
                                      oboemuse@msn.com Level 1
                                      Wanted to let you know, and anyone else know who might have had this problem, that as I re-read through articles about this problem, I ran across a reference about why the "unenexpected error has occurred" and though I'd read it previously, it suddenly hit me that I didn't have my php.ini pointing to the right include file.
                                      I altered my php.ini to point at where my libmysql.dll file was and
                                      BADA-BING BADA-BOOM! a connection was made.

                                      So I'm up and running, able to see all my database connections including those on a remote MySQL server as well as those that I've installed locally.
                                      • 16. Re: MySQL / PHP / Dreamweaver connection
                                        oboemuse@msn.com Level 1
                                        Wanted to let you know, and anyone else know who might have had this problem, that as I re-read through articles about this problem, I ran across a reference about why the "unenexpected error has occurred" and though I'd read it previously, it suddenly hit me that I didn't have my php.ini pointing to the right include file.
                                        I altered my php.ini to point at where my libmysql.dll file was and
                                        BADA-BING BADA-BOOM! a connection was made.

                                        So I'm up and running, able to see all my database connections including those on a remote MySQL server as well as those that I've installed locally.

                                        David, thank you for all your guidance. I'm also grateful for all the great advice and articles that are available here.

                                        oboemuse / Two Oaks Jerseys / aka Lorelei