11 Replies Latest reply on Jun 22, 2009 11:33 PM by Gaurav P(Adobe)

    'Send Failed' when using PHP Services


      I'm trying to display the contents of a table from a database using a datagrid. I followed the tutorial on this on the labs site, and it works great locally for me using WAMP.


      However I want to now deploy this simple Flex app to my website, which is hosted by Yahoo. I did a 'build release' in Flash Builder and copied the files over. When I view the created HTML page, instead of the DB table contents filling the data grid I just get a message that says 'send failed'.


      I actually had this working using Flex Builder 3, so my guess is it is not working for me now becuase Flash Builder 4 uses the Zend Framework with PHP services. I copied the Zend framework folder over to my site, but still I get 'send failed'.


      Has anyone else experienced this? Am I right in thinking the Zend framework is the culprit for the 'send failed' message? I know the DB login details are correct.  There is a file called 'gateway.php' that was autmatically created that has a path to the Zend framework folder. I've tried updating that too, but still no luck.

        • 1. Re: 'Send Failed' when using PHP Services
          SunilAdobe Adobe Employee

          Hi Steve


          1. Have you changed the endpoint url in the generated code for your service to point to the production server?

          2. Have you copied the amf_config.ini and changed it accordingly?




          1 person found this helpful
          • 2. Re: 'Send Failed' when using PHP Services
            Shikha Kaushik

            Hi Steve,


            Just need one more added info.


            Are you trying to use this PHP project created using FB3 in FB 4?


            If so, can you please try doing the following steps:

            1.In FB4 using DCD Feature create the PHP Service.


            2.Then export the release build.


            3.Import the release build and take care of the following points:

            1. install zend framework

            2. change the endpoint url w.r.t server settings

            3. place the services under the server location in the same path as it was during the service creation

            4. update the amf_config.ini file


            Please let us know if it helps!




            1 person found this helpful
            • 3. Re: 'Send Failed' when using PHP Services
              stevewareham Level 1

              Hi Shikha,


              Thanks for the reply. I'm using the PHP code automatically generated by FB 4, which I altered slightly with my database information. I did copy over the .ini file and updated the path to point to the Zend folder, but I don't think I changed the endpoint. Would that be in the gateway.php file?

              • 4. Re: 'Send Failed' when using PHP Services
                SunilAdobe Adobe Employee

                Hi Steve,


                The endpoint would be the in the mxml file as part of the generated code. If you have used the service using the "Bind To Data" dialog, It would be part of the declarations tag in the mxml file as shown below.




                <YourService :YourService id="YourService" destination="YourService" endpoint="http://localhost/YourProject-debug/gateway.php" fault="Alert.show(event.fault.faultString)" showBusyCursor="true" source="yourService"/>



                The localhost needs to be changed to the server, where you are deploying your swf.Also the YourProject-debug folder to the directory under the webroot where you have copied the swf files and the corresponding php files.


                Hope this helps.




                • 5. Re: 'Send Failed' when using PHP Services
                  stevewareham Level 1

                  Thanks Sunil,


                  Actually I hadn't done that. The endpoint was still set to localhost. I updated that and now I see when I launch the app it is trying to connect to my site instead of localhost. I still get the 'send failed' message though, so I must have something else wrong as well. I keep trying to update the path to the ZendFramework folder in either the gateway.php file, or the amf_config.ini file thinking that is the problem, but so far no luck.


                  I've tried setting


                  zend_path = http://www.mysite.com/Frameworks/ZendFramework/library


                  in the amf_config.ini file, which is in the same folder as the gateway.php file. I have the 'ZendFramework' folder in a folder called 'Frameworks' which is in the top-most level folder of my site.

                  • 6. Re: 'Send Failed' when using PHP Services
                    SunilAdobe Adobe Employee



                    If you see the code in gateway.php, the first few lines look like this


                    //default zend install directory
                    $zenddir = $_SERVER['DOCUMENT_ROOT']. '/ZendFramework/library';


                    //Load ini file and locate zend directory
                    if(file_exists($configfile)) {
                            $zenddir = $arr['zend']['zend_path'];


                    There are 2 options to set zenddir here


                    1. uncomment the zend_path in amf_config.ini to the actual location on the server, for example c:\webroot\Framworks\ZendFramework\library OR

                    2. change the $zenddir as given in the first line in the snippet of gateway.php


                    Option 1 is recommended as amf_config is a config file and that is what that should be modified.




                    • 7. Re: 'Send Failed' when using PHP Services
                      stevewareham Level 1

                      Thanks Sunil,


                      I've tried that all different ways, but still all I get is 'send failed'. I'll go back to the beginning and try again, I guess it must be something else. Thanks again.

                      • 9. Re: 'Send Failed' when using PHP Services
                        stevewareham Level 1

                        Thanks Mayank, that was helpful.


                        I just cannot get this work though. I'm giving up for now, I'll wait until that 'export release workflow' you mentioned is ready. Thanks.

                        • 10. Re: 'Send Failed' when using PHP Services
                          stevewareham Level 1

                          Trying one more thing, I try to run the file gateway.php, just to see what happens and I get the message below:


                          Parse error:  parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /Frameworks/ZendFramework/library/Zend/Loader/Autoloader.php on line 40


                          This makes me think that the configuration is right, because it can find this autoloader.php file, but perhaps my web hosting company does not support the appropriate version of PHP. Does that sound plausible to anyone?

                          • 11. Re: 'Send Failed' when using PHP Services
                            Gaurav P(Adobe)

                            Yes, this error occurs if you have a php version below php5 on your server.

                            Only versions over PHP5 are supported.