5 Replies Latest reply on Apr 12, 2010 11:57 PM by Anand Gaurav

    Flash Builder Configure PHP Service Problem - Zend AMF

    rsbrodie

      When I try to create a PHP data service, the process fails when trying to do a reflection on the PHP class.  It fails for an existing class, or a sample class that it creates either from a database or a template.  I've tried with 1.9.2, 1.10.2, and 1.9.4 (ships with Flash Builder) of the Zend Framework.  The message is:

       

      Server error File "SamplePhp1.php" does not exist or class "SamplePhp1" was not found in the file #0 /usr/lib/ZendFramework-1.9.2/library/Zend/Amf/Adobe/Introspector.php(96): Zend_Loader::loadClass('SamplePhp1', Array) #1 [internal function]: Zend_Amf_Adobe_Introspector->introspect('SamplePhp1', Array) #2 [internal function]: ReflectionMethod->invokeArgs(Object(Zend_Amf_Adobe_Introspector), Array) #3 /usr/lib/ZendFramework-1.9.2/library/Zend/Server/Reflection/Function/Abstract.php(368): call_user_func_array(Array, Array) #4 [internal function]: Zend_Server_Reflection_Function_Abstract->__call('invokeArgs', Array) #5 /usr/lib/ZendFramework-1.9.2/library/Zend/Amf/Server.php(356): Zend_Server_Reflection_Method->invokeArgs(Object(Zend_Amf_Adobe_Introspector), Array) #6 /usr/lib/ZendFramework-1.9.2/library/Zend/Amf/Server.php(550): Zend_Amf_Server->_dispatch('introspect', Array, 'Zend_Amf_Adobe_...') #7 /usr/lib/ZendFramework-1.9.2/library/Zend/Amf/Server.php(626): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http)) #8 /var/www/html/amfphp/PhotoTest-debug/gateway.php(69): Zend_Amf_Server->handle() #9 {main}

        • 1. Re: Flash Builder Configure PHP Service Problem - Zend AMF
          Radhakrishna Bhat Level 3

          Hi,

           

          Do the PHP files which you are trying to import contain Classes having same name as filename? Eg: If you are importing SamplePhp1.php, it should contain a class "SamplePhp1" for FB/Zend AMF to introspect.

           

          Or is this happening when generating new template? If so, please share your server configs (name, version, PHP version) and any other specifics in your project so that we can repro the issue here. 

           

           

          -Radhakrishna

          • 2. Re: Flash Builder Configure PHP Service Problem - Zend AMF
            rsbrodie Level 1

            It happens all of the time.  Even when creating a class from a template or the database.  And yes, the class name is the same as the file name.  One file I created a while ago worked with Flash Builder Beta 1, but I think I was using Fedora 9 at the time.

             

            The SamplePhp1 class that is referenced in the error messages was created by Flash Builder from a template.

             

            My server is Fedora 12 (kernel 2.6.31.6-166.fc12.x86_64).  My PHP version is 5.3.2.

             

            The PHP modules loaded are:

            curl.so
            dom.so
            fileinfo.so
            gd.so
            json.so
            ldap.so
            mysqli.so
            mysql.so
            pdo_mysql.so
            pdo.so
            pdo_sqlite.so
            phar.so
            sqlite3.so
            wddx.so
            xmlreader.so
            xmlwriter.so
            xsl.so
            zip.so

            • 3. Re: Flash Builder Configure PHP Service Problem - Zend AMF
              david.t.lanton Level 1

              Some lessons that I've learned from the way Flex sets up Data Services:

               

              If somewhere in your class you have anything that outputs text, the introspection will fail. Test the class directly in the web browser to verify that this isn't the case.

               

              Also another reason to test the class in the web browser before feeding it to Flex is to know that it's actually working. That it's a Flex problem, not a problem with your class itself.

               

              For whatever reason, if the class is above the webroot at time of introspection, introspection will fail. If you move the class above the webroot after that, it's not a problem. Just at the time of initial introspection that matters. I was planning to file a bug about that.

               

              Regarding the modules, I dont' think any of them matter. As long as you have Zend on your test server (gets installed by FlashBuilder anyway), that's all you need I believe. I don't recall having to specifically do anything else.

              • 4. Re: Flash Builder Configure PHP Service Problem - Zend AMF
                rsbrodie Level 1

                Thanks for the thoughts, David.

                 

                I have this class working with a Flash Builder project and had no problems with the introspection.  However, it's on a Windows XP box that includes Flash Builder, Apache, PHP, etc.  Where I have the problem is when I have Flash Builder installed on my Mac and the class installed on my Linux server which has Apache & PHP (which is my primary development environment).  I was able to get introspection working a while back when I was using a beta version of Flash Builder and an older version of Fedora.  I do remember I had to install some PHP module to get it to work back them, but I'm unable to find the post that described that problem and fix.

                 

                Also, the classes that are built from a template are in the correct location, but it still fails introspection.

                • 5. Re: Flash Builder Configure PHP Service Problem - Zend AMF
                  Anand Gaurav

                  From your first post, what I can deduce is that Zend is not able to find the required class/php-file you are trying to introspect.

                   

                  Could you cross check in the amf_config.ini file for directories added (value of amf.directories[]). This directory when appended to the the webroot directory (also mentioned in amf_config.ini file) should give you the exact location of the directory where your PHP service file - SamplePhp1.php should be located.

                  Could you cross check on that along with the permisions of that directory and the file.

                   

                  +anand