Welcome, Guest
  • Author Topic: how to get AMFPHP work in IIS (win Box)  (Read 19449 times)

    edgar sosa

    • Server what's that
    • *
    • Posts: 11
      • View Profile
      • Email
    how to get AMFPHP work in IIS (win Box)
    « on: 10/14/03, 21:26 »
    Hi , my name is edgar sosa.

    After a lot of frustration about trying to ge the AMFPHP to work on my pc running WindowsXP Pro. I came to these conclusions, I hope somebody find them usefull.

    You only have to pay attention to 4 things in the gateway.php files

    1.- You need to add one line in the flashservices/app/Gateway.php file

    Code: [Select]

    //add this line in case you don't have it, my .zip file downloaded from sf.net didn't had it
    require_once(AMFPHP_BASE."io/AMFInputStream.php");


    2.- You will need to change 2 lines in the gateway.php file in each virtual folder that runs an amfphp service, let me explain this.

    My current dir locations are as follow:
    a) the root of my webServer is at
    C:\Inetpub\wwwroot\

    b)my flashservices directory is at
    C:\Inetpub\wwwroot\flashservices\

    c)my basic example is at
    C:\Inetpub\wwwroot\basic

    d)I only had to change the following 2 lines in the file
    C:\Inetpub\wwwroot\basic\gateway.php to this.
    Code: [Select]

    include("C:\Inetpub\wwwroot\flashservices\app\Gateway.php");
    $gateway = new Gateway();
    $gateway->setBaseClassPath("C:\\Inetpub\\wwwroot\\basic\\services\\");
    $gateway->service();


    3.- It didn't made any difference the fact that I have or not have included the following line in my php.ini file
    Code: [Select]

    include_path = ".;c:\php\includes;c:\Inetpub\wwwroot\flashservices"

    it works well, with or without it.

    4.- You will need to comment out the followin lines in /flashservices/app/Executive.php
    Code: [Select]

       function checkRoles ()
       {
    /*
          if(isset($this->methodrecord['roles'])) {
             if(!Authenticate::isUserInRole($this->methodrecord['roles'])) {
                trigger_error("This user is not does not have access to " . $this->_methodname, E_USER_ERROR);
             }
          }
    */
       }


    I am still trying to get special characters like αινσϊ to work , cause even tough the mysql_query returns them properly, the flash does not support them, I already tried some simple examples that return a string containing the special characters and they show up correctly (in the debug window in flash), I still need to show them in a listBox in flash mx to see where is the error

    If anyone could post a workaround, or a working example showing for say, the results of a mysql_query wich contains words with the special characters αινσϊ on a listBox (flash mx UI2 component) it will be of great help.

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:how to get AMFPHP work in IIS (win Box)
    « Reply #1 on: 10/15/03, 02:52 »
    Hi Edgar, thanks for sharing your experience about amfphp in Windows box. Anyway I want to clear a couple of points

    To set the gateway.php in each folder, instead of using a Windows based path

    include("C:\Inetpub\wwwroot\flashservices\app\Gateway.php");
    $gateway = new Gateway();
    $gateway->setBaseClassPath("C:\\Inetpub\\wwwroot\\basic\\services\\");
    $gateway->service();

    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();

    Also in point 4, instead of disabling the Roles method in the Executive.php, disable it in your class, so next time you need to use Roles, you can. So comment instead a line like this in your class:

    $this->methodTable = array(
           "getFamily" => array(
          "description" => "Returns avaible Family of products",            "access" => "remote", // available values are private, public, remote
          //"roles" => "role, list",  ***Disable***
          "returntype" => "recordSet"
           ),

    Jorge

    edgar sosa

    • Server what's that
    • *
    • Posts: 11
      • View Profile
      • Email
    Re:how to get AMFPHP work in IIS (win Box)
    « Reply #2 on: 10/15/03, 13:42 »
    About:
    Quote
    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
    Code: [Select]
    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
    Code: [Select]
    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/realpath
    that 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.

    Flash-db

    • Administrator
    • Systems Administrator
    • *****
    • Posts: 1876
      • View Profile
      • Flash-db.com
    Re:how to get AMFPHP work in IIS (win Box)
    « Reply #3 on: 10/15/03, 23:33 »
    Thanks for posting that Edgar, I'm sure others will find it useful.
    Flash-DB

    a

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    Re:how to get AMFPHP work in IIS (win Box)
    « Reply #4 on: 11/06/03, 14:25 »
    I cannot get it to work either. I have Win2K, IIS and PHP installed fine. I have a lot of domains on my server, and I think that is the problem. My domains all originale from e:\httpd\ and I put the flashservices directory there e:\httpd\flashservices\

    Now, I have looke dat the link above and I have tried just about every setup process there is. I created a gateway.php file in the flashservices directory, and when I try accessing it from a browser, I get the pop-up to save the file. I simply cannot get my flash test files to work - they always give me the netconnection error.

    Does it matter where I put the swf?

    Is there a REALLY SIMPLE sample test file so I can just know if the server is working? I dont know if the server works, and my flash is incorrect or vice-versa.

    Any help is much appreciated.

    Thanks!

    By the way, I do not have anything in the 'doc_root' line of my php.ini file. Anything I put there causes php not to work.  ???

    I am trying the EchoTest example...


    My current gateway.php (in e:\httpd\flashservices\gateway.php) :

    <?php
    include("E:\httpd\flashservices\app\Gateway.php");
    $gateway = new Gateway();
    $gateway->setBaseClassPath("E:\\httpd\\flashservices\\services\\");
    $gateway->service();
    ?>



    The line I edited in EchoTest.fla:

    NetServices.setDefaultGatewayUrl('http://[myserver]/flashservices/gateway.php');

    ...that URL gives me the 'file download' popup in IE.


    I put the swf/html file in e:\httpd\flashservices and I get a blank page.


    I run test movie, and the last line is:

    EventType: "Status"
    MovieUrl: "file:////[myserver]/flashservices/EchoTest.swf"
    Source: "Client"
    Time: 1068147315402
    Date (object #1)
    ....."Thu Nov 6 14:35:15 GMT-0500 2003"
    Status (object #2)
    .....code: "NetConnection.Call.BadVersion"
    .....description: ""
    .....details: ""
    .....level: "error"





    What do I do?
    « Last Edit: 11/06/03, 14:41 by a »

    edgar sosa

    • Server what's that
    • *
    • Posts: 11
      • View Profile
      • Email
    Re:how to get AMFPHP work in IIS (win Box)
    « Reply #5 on: 11/07/03, 15:10 »
    Maybe this could help.

    My current config is like this.

    I extracted the AMFPHP files in
    C:\Inetpub\wwwroot\flashservices\
    wich can be accesed in my webserver like http://localhost/flashservices/

    When I access the url http://localhost/flashservices/app/gateway.php I don't get a prompt to save nothing to disk, as no binary data has been requested.

    My example application is located at
    C:\Inetpub\wwwroot\edgartest
    wich can be accesed like http://localhost/edgartest/

    My file at C:\Inetpub\wwwroot\edgartest\gateway.php is like this

    Code: [Select]
    <?php
        
    include("C:\Inetpub\wwwroot\flashservices\app\Gateway.php");
        
    $gateway = new Gateway();
        
    $gateway->setBaseClassPath("./services/");
        
    $gateway->service();
    ?>


    please notice how is that the first include has an absolute reference to the Gateway.php file in the flashservices directory, and how the $gateway->setBaseClassPath can be referenced by a relative position.

    NOTE: when I load the next url in my web browser http://localhost/edgartest/gateway.php I get a prompt to save the file gateway.php, this is normal as AMFPHP is trying to give me a stream of binary data (I guess).

    The flash file gets like this in the line:
    NetServices.setDefaultGatewayUrl('http://localhost/edgartest/gateway.php');


    So be very carefull to follow this guide to the proper installation of amfphp on a winBox as it can get kind of tricky.

    Cheers
    « Last Edit: 11/07/03, 15:16 by edgar sosa »

    a

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    Re:how to get AMFPHP work in IIS (win Box)
    « Reply #6 on: 11/12/03, 09:30 »
    Your suggestions were perfect - I am up and running!

    THANKS!

    joao carlos tchernev

    • Server what's that
    • *
    • Posts: 2
      • View Profile
      • Email
    Re: how to get AMFPHP work in IIS (win Box)
    « Reply #7 on: 03/16/05, 10:28 »
    hi, hello from Brazil....My Newstore work perfectly in IIS in windows box, without any modifications, including by paths: my folders structure: wwwroot/flashservices; wwwroot/newstore. incredible, but i follow the informations of this message board and my newstore didnt work....i simply follow the standart configurations and the things start working fine.

    clem

    • Server what's that
    • *
    • Posts: 45
      • View Profile
      • Email
    Re: how to get AMFPHP work in IIS (win Box)
    « Reply #8 on: 09/07/06, 13:07 »
    Hello, 

        I am having a big problem getting my remoting working on a Windows 2003 server. 

    I've followed your suggestionis rather closely and my flash remoting is still not working.

    Here's my gateway.php file:

    Code: [Select]
    //default gateway
        include "D:\Websites\my_website\flashservices\app\Gateway.php";

        $gateway = new Gateway();
        $gateway->setBaseClassPath("D:\\Websites\\my_website\\services\\");
        $gateway->service();

    Here's my NetServices code:

    Code: [Select]
    NetServices.setDefaultGatewayUrl("http://my_website.com/gateway.php"); i

    Any ideas?

    Clem C


    edgar sosa

    • Server what's that
    • *
    • Posts: 11
      • View Profile
      • Email
    Re: how to get AMFPHP work in IIS (win Box)
    « Reply #9 on: 09/11/06, 13:14 »
    what happens when you try to access your gateway.php file from your browser? (as in my example was in  http://localhost/edgartest/gateway.php)

    do you get a prompt to save the file? if not, then you are not setting up AMFPHP correctly, what error messages does the browser displays?

    remember that in my configuration I had 2 separate main locations, one was were the folder flashservices resides (C:\Inetpub\wwwroot\flashservices\ , wich can be accesed in my webserver like http://localhost/flashservices/ )
    and the second was where my example application was located, at C:\Inetpub\wwwroot\edgartest wich can be accesed like http://localhost/edgartest/

    My file at C:\Inetpub\wwwroot\edgartest\gateway.php (http://localhost/edgartest/gateway.php) is the one that prompts me to be saved when I try to access it by a browser.

    please post a description of what the browser shows or what happens in your browser when you try to access your gateway file.



    it also would be helpfull if you describe the location of your flashservices folder with respect to your main root webserver folder. (for example, my root webserver folder was in C:\Inetpub\wwwroot\, and I placed my flashservices folder at C:\Inetpub\wwwroot\flashservices\).

    levelfourdesigns

    • Server what's that
    • *
    • Posts: 7
      • View Profile
      • Email
    Re: how to get AMFPHP work in IIS (win Box)
    « Reply #10 on: 10/28/06, 23:44 »
    I have worked with IIS on Windows 2000, and 2003 servers with no problems at all.  I have done basic installations as well, PHP 4 and PHP 5 along with MySQL 4 and MySQL 5.  my PHP installs I make sure I turn on various extensions, perhaps that is helping me?

    I have also made virtual directories in 2003 and 2000 and amphp always works.  The only settings I change in the AMFPHP folders are the services.  Maybe I'm just lucky, but man amfphp is slick...

    I have even uploaded it all to godaddy hosting and it works flawlessly there as well.

    Josh Jones

    mmore

    • Server what's that
    • *
    • Posts: 2
      • View Profile
      • online dating
      • Email
    Re: how to get AMFPHP work in IIS (win Box)
    « Reply #11 on: 01/23/12, 21:39 »
    i was having two problems and both are solved here. Thanks man.