Hi, I've been using AMFPHP successfully for a number of Flash based sites using Drupal as a CMS. I have a client who is using godaddy hosting and have run into a problem receiving results in Flash. The connect and calls work fine and I can see them being made in the netconnection debugger but there just are never any returns coming back.

I had this working fine on my production server. Just after copying to the live server it doesn't. I've checked and double checked my connection string and it seems to be correct. I've also made a crossdomain.xml as well. In Drupal I'm able to use the service browser and everything works as expected so that tells me that AMFPHP and services should be functioning normally.

Could it be something as simple as incorrect file/folder permissions? Any other thoughts?

Thanks!

Comments

snelson’s picture

Sounds like a crossdomain thing to me. Check to make sure your crossdomain handles both www.domain.com and domain.com, I usually just use "*domain.com". Also, make sure your swf is not trying to connect back to the dev server rather than the live server. I usually set my gateway to "/services/amfphp" and not the full domain "http://domain.com/services/amfphp" for this reason. Also check that you are getting a response from AMFPHP when you call the gateway from the browser.

Scott

horizens’s picture

Thanks for the speedy reply, Scott.

My crossdomain.xml file is set up exactly as you described. I've also tried the connection string as you suggested without any success.

When I use ServiceCapture to view the calls and results, on the dev server everything registers as expected and shows that there is an amf request taking place. On the live server, I do not get the same results - it does not register as amf only as text.

The directory structure is the same on both servers. Drupal is not in the root directory but instead in it's own /cms directory.

http://www.productionserver.com/~client/cms/services/amfphp

http://www.liveserver.com/cms/services/amfphp

horizens’s picture

When I call AMFPHP directly from the browser I get this message:

amfphp and this gateway are installed correctly. You may now connect to this gateway from Flash.

So it appears to be running correctly. Very odd.

horizens’s picture

Man, this driving me a little crazy.

Just for kicks I installed AMFPHP in the server root and ran the HelloWorld.php test (according to the docs on amfphp.org) and that worked fine so I'm sure that the server will run it. I've also tried reinstalling AMFPHP 1.9, the AMFPHP module, and the Services module but I'm still getting the same results. I also tried "*" and "*.thedomain.com" in the crossdomain.xml file. No go.

I'm wondering if having drupal in the /cms subdirectory is throwing things off.

dragonlist’s picture

My drupal is not installed under DocumentRoot.

When i tried Gateway: http://localhost/drupal/services/amfphp from browser, I got an error: undefined method $gateway->setAmf3RecordSetFormat()

After modifying file amfphp.module, removing line //$gateway->setAmf3RecordSetFormat("ArrayCollection");
and a few lines after that, the gateway are shown correctly in my browser.

When calling service method: user.login( 'user01', 'passwd01' ) from Flex app, the result is correct.

dragonlist’s picture

For horizens, drupal should be installed as root, not under /cms, it is giving you trouble.

If you move drupal to the root, your gateway should be like

http://www.liveserver.com/services/amfphp

I tried it on production server where I put drupal as root, it is working fine for me.

horizens’s picture

Hi, Dragonlist. Thanks for the tips! As it turned out, godaddy support suggested that I modify the .htaccess file (in the root) with the following:

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

Which apparently switches the php version from 4 to 5. It did the trick and my CMS is running perfectly in the /cms directory. I'm glad to have finally fixed the problem and know that the CMS will work for godaddy clients.

Chris Charlton’s picture

The error: undefined method $gateway->setAmf3RecordSetFormat() is because you are using beta 2 of AMFPHP2, you need to use beta1 for now.

snelson’s picture

Guys, the amfphp module has been updated and now requires AMFPHP 1.9 beta 2 available here: http://www.5etdemi.com/blog/archives/2007/01/amfphp-19-beta-2-ridiculous...

gabiroba’s picture

I've got a problem receiving results in Flash too. Everything is allright but I keep receiving the event result handler error.
Can anyone tell me why is it happening?

Thanks!

mwalczyk’s picture

I has the familiar error, amfphp worked fine in test location, but in production server communication between flash and drupal fails (with xmlrpc and python client too), in network analyzer data was transferred to flash, but in flash app nothing happen. I noticed that every generate page in drupal starts with newline. This bug is described there: http://drupal.org/node/18265 and http://drupal.org/node/18265.

Just add in includes/bootstrap.inc
function drupal_page_header() {
$clean = ob_get_contents();
ob_end_clean();
...
The solution described above is working for me.

I wrote simple test application in python:
#! /usr/bin/env python
import xmlrpclib, math
server = xmlrpclib.Server("http://www.example.pl/xmlrpc.php")
print server.node.load(135730,[])

You have to change endpoint and nid (135730), if you get error like this:
xml.parsers.expat.ExpatError: xml declaration not at start of external entity: line 2, column 0
solution described above should help.

marcingy’s picture

Status: Active » Closed (fixed)