About:
Use a server base path, so you can port (having the same folder structure) from your localhost to your server without problems. Could be
include("../flashservices/app/Gateway.php");
$gateway = new Gateway();
$gateway->setBaseClassPath("./services/");
$gateway->service();
I tested the line with
$gateway->setBaseClassPath("./services/");
and it worked all right.
That works because the ./services/ is relative to the current document and directory, so it will work
The problem comes when you use the relative or absolute virtual path translation in an include statement, for example
My /flash/app/gateway.php file resides in
C:\Inetpub\wwwroot\flashservices\app\Gateway.php
The next statement:
include("/flashservices/app/Gateway.php");
returns me the following error
Warning: main(/flashservices/app/Gateway.php): failed to open stream: No such file or directory in c:\inetpub\wwwroot\basic\gateway.php on line 46
Warning: main(): Failed opening '/flashservices/app/Gateway.php' for inclusion (include_path='.;c:\php\includes;c:\Inetpub\wwwroot\flashservices') in c:\inetpub\wwwroot\basic\gateway.php on line 46
Fatal error: Cannot instantiate non-existent class: gateway in c:\inetpub\wwwroot\basic\gateway.php on line 49
This other next statement:
include("../../flashservices/app/Gateway.php");
as it is relative to the current gatway.php file in (/basic/gateway.php) returns the next error
Warning: main(../../flashservices/app/Gateway.php): failed to open stream: No such file or directory in c:\inetpub\wwwroot\basic\gateway.php on line 45
Warning: main(): Failed opening '../../flashservices/app/Gateway.php' for inclusion (include_path='.;c:\php\includes;c:\Inetpub\wwwroot\flashservices') in c:\inetpub\wwwroot\basic\gateway.php on line 45
Fatal error: Cannot instantiate non-existent class: gateway in c:\inetpub\wwwroot\basic\gateway.php on line 49
The problem resides in that php can not determine the file system equivalent for an absolute relative (you know what I mean) path in IIS, I read this can be done using a function from Apache in php, so php can ask apache for the real ubication of a path. sadly in IIS with php this is not possible (for what I have read, correct me if I am wrong)
You can see in the user comentaries in this url:
http://mx.php.net/realpaththat it is kind of hard to find the real file system equivalent when it comes to relative paths.
So, I recommend to put the include statement like
include("C:\Inetpub\wwwroot\flashservices\app\Gateway.php");
In the installation of amfphp or in some sites (I really don't remember where I saw this) recommend to use the include_path directive in the php.ini file , my was like this.
include_path = ".;c:\php\includes;c:\Inetpub\wwwroot\flashservices"
but I didn't find the use for it, when it was activated (not commented) I tried to use the include like
include("Gateway.php");
and it seemed like php tried to include the same file over itself.
so I decided to use my include statement in an absolute to the filesystem directive.