Php classes outside webroot are currently not supported by the data introspector. You can however, use the sample generation to get an idea of how to access the php service from your flex application and then handcode a custom service and gateway.php file.
Yes, well hopefully this will be supported in the future. In the mean time, I've noticed that it's only actually when creating the service and the API for it that you need to have the class inside the web root. In order to configure the return types and input types you don't need to go through the standard gateway.php anymore. So, although not ideal, here's how I do it right now:
1. I have set up m zend framework as described in my first post, with my AMF service gateway being a Zend controller and not the gateway.php
2. I create the service class with the API I need inside the application/services/amf folder. If the service needs to connect to the database then I create a Zend Db Model using the zf command line tool (as per Zend framework practices) and then hook my service class to use that. Which basically means that my service classes are very slim and simple.
3. When I created the Flex project I created a dummy service using the sample php, which has set up Flash builder with the default gateway and so on
4. Once I've created my service class, I copy the file to the default location where Flash Builder wants to create my services. I then strip out any implementing code from the copied file, leaving only the public API and empty methods.
5. I then create a new service in Flash builder, point it to the stubb class in the default location and let the introspection discover the public api. This will of course mean that all input values and return values are generic objects.
6. After this is done I delete the stubb class. In the created AS service class I override the service endpoint so that it points to my real gateway controller within the zend framework.
7. After this is done I can configure the return types and input types using auto discovering. It will connect to the real gateway and ignore the default gateway and thus I can develop against the real endpoint and don't need to create my service classes within the public location of the Zend folder structure.
It's a bit of a workaround for sure, but since I don't create new services that often and I can have Flash builder update my return types etc. automatically this way, I figure it's worth the extra steps. Still, I would hope that in the future Flash builder will support having the introspection happen on a location outside the projects own web root.