I have a simple configuration for Flex project ( with WAMP server connected and AMFPHP included ). And everything seems to work, I can call simple PHP class methods from Flex and retrieve the returned data.

But then I have this little problem. I am using additional PHP library, which uses the relative paths to include or find another files. So here is a simplified Amfphp/Services/ directory:

Services

MyExampleService.php

lib

MainLibraryFile.php

classes

LibraryGlobalClass.php

wsdl

LibraryGlobalService.wsdl

etc

LibraryConfig.php

Then after some MainLibraryFile work, the LibraryGlobalClass.php wants to read LibraryGlobalService.wsdl. It is constructed the way, that the path to the wsdl's directory is saved in LibraryConfig.php, so the GlobalClass first reads the path to the wsdl's from Config file, and then concatenate it with the name of the Service wsdl file name.

And it seems that this two dots ( parent directory ) do not work the same way in this Amfphp call. It is not going from etc dir to lib dir ( via .. ) and then to wsdl dir, instead it creates some crazy link that cannot be resolved.

I wonder if there is a way to change it somehow, or I am just missunderstanding something.

1 Answer
1

Best practice is to use absolute paths, not relative. How about replacing $ConfigPathToWsdl by something like dirname(FILE) . '/../wsdl' ? Note it's FILE surrounded by double underscores, as shown here in the comments here http://php.net/manual/en/function.dirname.php

Thanks for the answer :) I tried to use dirname but it did not solve the problem. So i ended up with making absolute paths ( but relative to the library root folder, which I included in the main library file ).
–
CinkoskinkJul 24 '13 at 10:22