5 Replies Latest reply on Sep 5, 2011 8:00 PM by kushpa

    Please help with Zend connection problem to database on deployment to outside server

    kushpa Level 1

      I have successfully completed the tutorial for Flashbuilder 4.5 "Test Drive" located here:

      http://www.adobe.com/devnet/flex/testdrive.html

       

      The project works perfectly fine on my local Mac server (Snow Leopard), no problems connecting to database or displaying data. However, when I attempt to transport the project to my outside server, it does not work. I have followed every step very carefully as outlined here:

      http://www.adobe.com/devnet/flex/testdrive/articles/4_deploy_app2.html

       

      • the Zend Framework is installed on the server

      YES, I have hosting with SurpassHosting.com, and have the Zend Framework successfully installed.

       

      • the gateway.php and amf_config.ini files are placed on the server  and updated to reflect proper locations on the production server

      YES, and according to online research I've found, my gateway.php file confirms that the Zend connection is

      working okay (that is, properly mapped in the amf_config.ini file) by displaying the message, "Zend Amf Endpoint": http://costinmultimedia.com/FlexWebTestDrive-Release/gateway.php

       

      • the PHP classes that the Flex application calls are located in one of the directories specified in the amf_config.ini file.

      YES, all files in the "Release" folder were copied over to the server, in the same folder.

       

      The ONLY thing that changes between the local server and the remote server (obviously, besides the absolute paths to the ROOT and the ZEND FRAMEWORK, which, as demonstrated, seem to both be correct and working properly) are the USERNAME, PASSWORD and DB_NAME of the database. Before I build the final RELEASE version, however, I comment out the U/P/DB names used for the local server, and replace them with the U/P/DB for the remote server. I then "Refresh" my "EmployeeService" Data Service in the project, rebuild the project, and copy THOSE files to the remote servers. For the record, when I use this "updated" version for the remote server, it does NOT work on my local server (as it well should not, with the wrong U/P/DB names), so that indicates to me that the new information is being updated in the refresh/rebuild.

       

      Also, I can confirm that this login information (U/P/DB names) is CORRECT via a PHP test, which successfully accesses the database:

      http://costinmultimedia.com/FlexWebTestDrive-Release/test/test.php

      (I didn't echo the PASSWORD, but it's correct as well.)

       

      Now, here is perhaps the most confusing part. When I attempt to run the application, I get an error box with NOTHING IN IT!!

      http://costinmultimedia.com/FlexWebTestDrive-Release/FlexWebTestDrive.html

       

      How do I debug a problem when I can't get the application to return an error message? Has anyone else ever run into this? I can't be the first! Adobe people, can you help me here? I have quadruple-checked my spelling for typos, the ONLY changes I'm making are the U/P/DB names, they work from a standalone PHP page, the Zend path seems to be working . . . I'm at my absolute wits end, I've been trying to troubleshoot this for a WEEK now, and have no more ideas . . .

        • 1. Re: Please help with Zend connection problem to database on deployment to outside server
          D Baron Level 1

          Hi Kushpa,

           

          I had a very similar 'setup' and situation.  I am using Flex 4 (not 4.5) to connect to PHP and then to mySQL.  All worked perfectly on my Win 7 box with a typical WAMP setup.

           

          Then I moved to a Linux hosted system.  I verified everything like you did.  I went through an agonizing week of things not working though.  The 'setDirectory' thing inside the gateway.php file was simply not working even though the gateway file echo'd back out that is was a valid endpoint.

           

          I am not sure about your blank error window thing.  I spent a little money to buy a tool called "Charles", which can intercept and display all AMF calls to and from your Flex app and the PHP app.  I strongly suggest you get something like that to see what the true error might be.

           

          In the end, I edited out (commented out) the 'loop' inside the gateway.php file that tries to 'setDirectory' to every directory you listed in the amf_config file.  Instead, I essentially hard-wired it as such:

           

          $server->addDirectory(dirname(__FILE__) . '/services/');

          The gateway.php file sits at the root of my app, and there is a 'services' directory inside that which contains all of my 'service classes'.

          Let me know if this helps and if you can find the tool.

          -David
          Centennial, CO
          1 person found this helpful
          • 2. Re: Please help with Zend connection problem to database on deployment to outside server
            kushpa Level 1

            Thanks so much for responding, David, I was really in a bind, and nobody seemed to have any ideas!

             

            I downloaded Charles Proxy and was easily able to install it and find the error for what's going wrong. Unfortunately, the feedback is all a bunch of string code that makes no sense. And, wouldn't you know it, charlesproxy.com, where they have the documentation online, is spitting back 503 errors today! *sigh*

             

            I forwarded this to my host tech support, they're great support folks, but have no experience on Zend/Flex, and, obviously, can't support everyone's coding issues. They've assured me they'll continue to help me troubleshoot errors, and with Charles now, I at least feel like I can get some feedback on what's going on silently in that Zend/AMF zoo.

             

            This was a huge step toward helping me get this resolved, I'll definitely update you on how things turn out over the next few days. Thanks again!

             

            Kushpa

             

            P.S. Here is the summary of the "Response" report tree, under the directory of:

             

            AMF_Message ==> Body ==> [0] ==>

                 Target (String) = /2/onStatus

                 Content (Object) = flex.messaging.messages.ErrorMessage

                      faultCode (Integer) = 0

                      correlationId (String) = 7B9CF1B6-E0F5-9A24-9AFD-16D22617943C

                      clientId (String) = 747D5F82-F3CE-9369-8A1B-00004FDDB1C4

                      messageId (String) = 7624F940-B896-1F89-BAE8-000037FCC54D

                      timestamp (String) = 131464286400

                      timeToLive (Integer) = 0

             

            I also have the "Request" screen that preceded this response (on the remote server, which does NOT work), along with the EXACT same data for the locally running site that works fine. For the sake of comparison, following is the exact same data as above, except on the local site that works:

             

            AMF_Message ==> Body ==> [0] ==>

                 Target (String) = /2/onStatus

                 Content (Object) = flex.messaging.messages.AcknowledgeMessage

                      faultCode (Integer) = N/A

                      correlationId (String) = 2B6ED8EB-237F-D8B7-F438-16D45AF563D3

                      clientId (String) = 3970CCE2-80D5-0D08-5BCA-000020466946

                      messageId (String) = 7F36B383-3DD4-0BC9-834D-00002731AD08

                      timestamp (String) = 131464300800

                      timeToLive (Integer) = 0

             

            Make any sense to anyone?

            • 3. Re: Please help with Zend connection problem to database on deployment to outside server
              D Baron Level 1

              Hi Kushpa,

               

              So... the stuff you posted below (response from your server) looks 'good' to me.  However... tell me a bit more.  You are essentially 'calling a function' inside of a php page.  Tell me:  What do you pass to the function (parameters, types, etc...) and what do you 'get back' from the function?  Is it a simple intrinsic (string, int, etc...) or a complex 'object' (i.e., a "person object", consisting of a 'name', 'age', 'gender', etc...)?

               

              The more you provide here the better.

               

              -David

              • 4. Re: Please help with Zend connection problem to database on deployment to outside server
                kushpa Level 1

                Ok, I found the cause of the blank error dialogue box. In the amf_config.ini file, I had the amf.directories[] = "FlexWebTestDrive/services". This is the location of the EmployeeService.php file (the data services file, located in the "services" folder). HOWEVER, when I exported the release build, I specified it into a specific build folder called "FlexWebTestDrive-Release". When I uploaded the amf_config.ini file, I forgot to add the "-Release" on to the amf.directories[] pathname, so it was looking in the wrong folder. STILL, it would have nice to have gotten some kind of feedback besides a blank box.

                 

                NOW I'm getting a NEW error @ http://costinmultimedia.com/FlexWebTestDrive-Release/FlexWebTestDrive.html:

                "Channel disconnected
                Channel disconnected before an acknowledgement was received"

                 

                Still working on this, but I did find something that said if I'm deploying to a shared server, I might not be able to use "mysqli" commands, and have to rebuild the PHP file using MySQL comands? Anyone ever heard of that? I've got a call in to my host now to find out of this is the case (I'm on a shared server). I'll update this post when I find the answer.

                • 5. Re: Please help with Zend connection problem to database on deployment to outside server
                  kushpa Level 1

                  Problem solved, thanks so much to everyone for their help! Charles Proxy helped TREMENDOUSLY. After I eliminated the first error with the blank error dialog box (that was caused by an incorrect pathname), Charles nailed it down to a login issue with the database. It came down to two problems:

                   

                  1) I had the wrong amf.directories[] path in the amf_config.ini;

                  and

                  2) I needed to Refresh the FB project AFTER I made the changes to the EmployeeService.php data service file, then rebuild the export and re-deploy.

                   

                  Thanks again, everyone!