1 2 Previous Next 16 Replies Latest reply on Jan 16, 2017 11:25 PM by user19752

    Using Filmaker Server 15 and Custom Web Publishing

    Kobyashi

      I'm trying to create a solution using PHP where, a remote web page run on a different server to the Filemaker Server, can add and update records. I've written the code and tested locally, that is on the same server as the FMS. It works flawlessly.

       

      I've taken the same website code, purchased a hosting solution and uploaded it but I am receiving error 500, a web server error, apparently from the remotely hosted webserver. My assumption is that at the point I am calling the following code, precisely here $result = $newAdd->execute(); it is not getting a connection with the Filemaker Server.

       

      function saveNewRecord($recordData)
      {

      $fm = new FileMaker($this->databaseName, $this->hostName, $this->userName, $this->password);
      $newAdd = $fm->newAddCommand($this->tableName, $recordData);
      $result = $newAdd->execute();


      if(FileMaker::isError($result))
        {
        $this->msg = 1;
        die('Error - ' . $result->getMessage(). ' (' . $result->code . ')');
        }else{
        $tmp = current($result->getRecords());
        $this->userRecID = $tmp->getRecordID();
        $this->msg = 2;
      }

      }

       

       

      Should this be possible?

        • 1. Re: Using Filmaker Server 15 and Custom Web Publishing
          wimdecorte

          Yes, it should be possible.  How did you define the connection in code?  And are all the relevant ports open from the outside?

          • 2. Re: Using Filmaker Server 15 and Custom Web Publishing
            planteg

            Hi Kobyashi,

             

            yes that can be done. See Questions about CWP with PHP  Malcom Fitzgerald provided the clue:

             

            1. Wherever you have put it, go into Filemaker/conf/ and edit the conf file.
            2. You want to be pointing to the IP of your FMS and you'll be using HTTPS.

             

            Hope that helps

            • 3. Re: Using Filmaker Server 15 and Custom Web Publishing
              Kobyashi

              I'll go and check out that link thank you. I'm supposing that this communication has to be done via https.

              • 4. Re: Using Filmaker Server 15 and Custom Web Publishing
                Kobyashi

                Well, I edited the FileMaker API conf but still no success. By the way, does anyone know if filemaker-api.php is meant to be missing a closing php instruction (?>) ? I noticed it while editing.

                 

                If, using a web browser, I load the URL for the server, I see an icon containing a large T and "FileMaker Database Server Website". I see this whether I use port 81 or 444, the two ports I had to assign to the web database. My view is that his means it is visible but it would help if someone could confirm this.

                 

                By way of more information about my simple web pages. I have a form which is submitted to a processing page. This page checks integrity and does a few other things as well as assigning all the data to an array. A class, required by the processing page contains the function I originally posted.  It is at this function that it all grinds to a halt with only the error 500.

                 

                Now, if I instead post the form to the same processing page on the same machine which contains the Filemaker Server then it successfully calls the same function and creates a record.

                 

                Any further comments will be gratefully accepted!

                • 5. Re: Using Filmaker Server 15 and Custom Web Publishing
                  Malcolm

                  Almost everything in the world is expecting HTTPS to be on port 443. In the conf file, you may have written : "https://your.server.name". If you are on port 443 that's OK. If 443 doesn't work, no-one is going to start guessing that you have setup a completely unique arrangement. You have to include the port that you've chosen for your HTTPS traffic, "https://your.server.name:444".

                   

                  When you decide to change the default setting you are taking a lot of responsibility. Be prepared for all the issues that may arise from that decision.

                   

                  Malcolm

                  • 6. Re: Using Filmaker Server 15 and Custom Web Publishing
                    Kobyashi

                    Indeed and these are the changes I made. However, what I'm not clear on is if a https connection is mandatory or not.  Furthermore, it still doesn't work .

                    • 7. Re: Using Filmaker Server 15 and Custom Web Publishing
                      planteg

                      Kobyashi,

                       

                      my own filemaker-api,php file does not have the closing tag ?> Can't tell for sure, but it seems that the closing tag would not be essential.

                       

                      Now back to you issue, here is the modified section of my filemaker-api php file

                       

                      //$__FM_CONFIG['hostspec'] = 'http://127.0.0.1';
                      $__FM_CONFIG['hostspec'] = 'http://192.168.1.112';
                      

                       

                      In my case the external Web server is on 192.168.1.113 and FMS is on 192.168.1.112.

                       

                      The simplest way to test your setup is to copy php test file (phptest.php) from the FMS server to your external Web server. The changes I made are these:

                       

                      Original file:

                       

                      if (class_exists("FileMaker")) {
                        $fm = new FileMaker('FMServer_Sample', NULL, NULL, NULL);
                      

                       

                      Edited file:

                       

                      if (class_exists("FileMaker")) {
                        $fm = new FileMaker('FMServer_Sample', "192.168.1.112:180", NULL, NULL);
                        
                        if (FileMaker::isError($fm)) 
                        {
                        echo("Ouverture FMServer_Sample: " );
                        echo ($fm->getCode() . " " . $fm->getMessage() . "<br>");
                        }
                        
                        $command = $fm->newFindAllCommand($layout);
                        $impl_data = $command->execute();
                        $error = NULL;
                        if (FileMaker::isError($impl_data)) {
                          $error = $impl_data;
                        echo("Une erreur est survenue: " . $impl_data->getMessage() . "<br>");
                        exit;
                        }
                      }
                      

                       

                      I added line 4 to 8 to catch the error if one arises while opening the database. Look at the link to call the PHP test page on the server, you will need to pass the lang parameter.

                       

                      That should help... I say should because i just tried and it failed .

                       

                      Updated

                       

                      I moved my FM Server to another computer and the ip address changed as well as the port . Now all works fine, there are no reason you shouldn't succeed.

                      • 8. Re: Using Filmaker Server 15 and Custom Web Publishing
                        Kobyashi

                        Thanks for taking the time to send me this information. I did try this and it fails with a server error 500 as always.

                        I noticed that, in your example, both your FMS and webserver where within the same local network. I mention it because mine aren't. This said, I don't think it matters.

                         

                        Where does it fail? If I specify the correct information, that is my correct IP (I've substituted a local IP here) along with the correct ports, either 81 or 444 I get the 500 error after about 20 seconds.  If however, I specify a port on the same server but used for something else, it fails immediately. This encourages me to think that a connection is being made but FMS is just not replying.

                         

                        $fm = new FileMaker('FMServer_Sample', '192.168.1.1:81', NULL, NULL);

                         

                        or

                         

                        $fm = new FileMaker('FMServer_Sample', '192.168.1.1:444', NULL, NULL);

                         

                        fails after a delay but

                         

                        $fm = new FileMaker('FMServer_Sample', '192.168.1.1:80', NULL, NULL);

                         

                        fails instantly.

                         

                        Knowing that this code runs perfectly when run locally is very frustrating.

                        • 9. Re: Using Filmaker Server 15 and Custom Web Publishing
                          planteg

                          You use ports 81 and 444. Have you configured port forwarding in you router, that is 81 --> 80 and 444 --> 443 ? Or did you change the FMS installation to use 81 and 444 ? Either way, the ports needs to be open in the router.

                           

                          According to Error codes for Custom Web Publishing | FileMaker , error 500 is:

                           

                          500    Date value does not meet validation entry options.

                           

                          I understand your frustration. Making it's way with CWP is not that easy and the documentation is not that clear (at least to me).

                          • 10. Re: Using Filmaker Server 15 and Custom Web Publishing
                            Kobyashi

                            Yes, the ports were set at install as 80 and 443 are being used by Kerio.

                            The error is coming from my web server and not the FMS.

                            If I go to the host address I have set up in the FileMaker API conf  and used in my class to connect I see the image inserted below on pages for both ports 81 and 444. This surely means that a connection is possible? In addition, I keep coming back to the other scenario where, if I post the data from my web server form to the API running on the FMS web server instead of the identical (except host specs) page on my web server,  it works! Frustrating.

                             

                            I've been trying to think of a reason why (or even how) my web server hosting company could be responsible but I can't think of anything. FMS.jpeg

                            • 11. Re: Using Filmaker Server 15 and Custom Web Publishing
                              Malcolm

                              Kobyashi wrote:

                               

                              By the way, does anyone know if filemaker-api.php is meant to be missing a closing php instruction (?>) ?

                              It is that way, by design.

                              • 12. Re: Using Filmaker Server 15 and Custom Web Publishing
                                Malcolm

                                Kobyashi wrote:

                                 

                                if I post the data from my web server form to the API running on the FMS web server instead of the identical (except host specs) page on my web server, it works!

                                 

                                 

                                You can have FMS set up in a single machine or two machine configuration. If you set up a two machine config, one machine runs FMS and the other runs WPE. In a single machine configuration FMS and WPE run on the one machine. Your CWP code should target the IP of the machine running WPE.

                                 

                                You can also place the CWP code on a remote machine. The CWP code should be targeting the IP of the machine running WPE ( in a single machine config that is also the machine running FMS ).

                                 

                                Malcolm

                                • 13. Re: Using Filmaker Server 15 and Custom Web Publishing
                                  Kobyashi

                                  Yes, this is pretty much what the issue is all about. I have a single config installation, I was just trying to highlight the fact that my CWP code, which runs perfectly well on that machine, does not work on my web server.

                                  • 14. Re: Using Filmaker Server 15 and Custom Web Publishing
                                    planteg

                                    As far as I understand, Kerio uses 80 and 443, and FMS 81 and 444. Then the router should be set to route port 81 to a.b.c.d (internal address) port 81, and port 444 to a.b.c.d (internal address) port 444.

                                     

                                    If you have a look at the logs in FMS, select all logs, is there any indication that a tentative was made to contact FMS ?

                                    1 2 Previous Next