2 Replies Latest reply on Aug 21, 2016 8:51 PM by user27350

    Two-machine deployment issue: PHP on worker can't see databases on master



      Two-machine deployment issue: PHP on worker can't see databases on master

      Your post

           We are working on a two-machine deployment with FileMaker Server Advanced 13 on two Windows Server 2008 R2 virtual servers. The frustrating part of this is that I had previously created a two-machine deployment with FileMaker Server 12 on a pair of similar virtual servers while developing our application. But now that we are ready to go production, I can't get the new web server, which is running the FileMaker API for PHP, to see the new database server.

           In the end, I stripped the code down to a test call against the demo tables supplied by Todd Duell with his book "FileMaker API for PHP 12". (I've removed our DB server IP for security reasons):

      require_once ('FileMaker.php');
      $fm = new FileMaker('php_demo', '<IP here>', 'Admin', '1234');
      $dbs = $fm->listDatabases(); /*will work regardless of validity of login */
      if (FileMaker::isError($dbs)) { /*can't connect to server*/
        echo 'Error listing databases!<br/><br/>' ;
        echo $dbs->getMessage();
      <more code here, in case the call succeeds...>

           Even this simplified code fails with the dreaded error:

      Communication Error: (22) The requested URL returned error: 404 Not Found - This can be due to an invalid username or password, or if the FMPHP privilege is not enabled for that user.

           I interpret this to mean that the PHP API is simply not seeing the hosted databases. My web searches on this message don't turn up much of use. The best summary I have found so far, which is where I got the listDatabases() strategy is here:


           Our IT division and I are scratching our collective heads over this. We suspect it's an OS issue (we have made some server OS changes lately), but we are at a loss. For what it's worth, the firewalls on both servers seem to be correctly configured. Repeated uninstalls and reinstalls haven't changed this symptom.

           There are some other odd symptoms, one of which I mentioned in another note yesterday: the Technology Tests Page was never installed. This means I can't use the Technology Tests Page to try to diagnose the deployment issue. However, when I run the deployment (or edit the deployment), the deployment logs don't show any errors. And the database server seems to serving databases without problems.




        • 1. Re: Two-machine deployment issue: PHP on worker can't see databases on master

               I won't say I have solved this problem, but I have made it go away. What bothers me is that the way I made it go away should have broken it even more severely.

               Because the way to solve the problem is to comment out the hostspec statement when you set up the FileMaker() object. No, really:

               This code fails:

                        require_once ('FileMaker.php');
                        $fm = new FileMaker();
                        $fm->setProperty('database', 'php_demo');
                        $fm->setProperty('hostspec', '');
                        $fm->setProperty('username', 'Admin');
                        $fm->setProperty('password', '1234');
               This code works:
                             require_once ('FileMaker.php');
                             $fm = new FileMaker();
                             $fm->setProperty('database', 'php_demo');
                             //$fm->setProperty('hostspec', '');
                             $fm->setProperty('username', 'Admin');
                             $fm->setProperty('password', '1234');

               Although this would be perfectly normal in a single-machine deployment, I have a two-machine deployment. Now, it makes perfect sense that the worker machine should know where the master machine is without being told -- after all, the two machines were working together during the deployment process. I can easily imagine that part of that is the master machine telling the worker, "I have your files!"

               But I see nothing in the PHP API documentation that hints that you can leave hostspec out in a two-machine deployment. In fact, it's stated that the hostspec defaults to the loopback address ( if you don't set it. So having it default to the IP of the master machine is seriously weird behavior. It's even weirder that telling it the IP of the master machine breaks the connection. And it's weirder yet that this code USED to work correctly. Nothing has changed on my development servers (which still have FileMaker Server 12, and all my original, previously-working files) except for some Windows OS updates. But now my PHP files fail, unless I comment out the hostspec.

               All of which makes me suspect that this is a Windows OS issue, rather than a FileMaker or PHP API issue. I have had some other weird problems on my virtual servers recently. And what most of these have in common their inability to see IP numbers properly, either their own, or the loopback, or the "localhost" version of the loopback, or the IP numbers of other machines. Both of my development virtual servers, as well as the two new virtual servers destined to be production servers if and when I can get them working properly, are running Windows Server 2008 R2. I've seen some other messages on these forums that mention weird behavior on Windows Server 2008 R2. Coincidence? It's a common server OS in the Windows environment.

               I am working with our IT office on this, but I suspect their response will be "you've fixed the problem, don't fuss with it." But considering HOW I have fixed it, I am not comforted by this idea. I would much rather have my code working properly, as documented, than trust my web server to maintain its weird psychic connection with my database server once we go production, especially if another Windows update repairs the issue.

               If anyone has any thoughts on this, I would be delighted to hear them.



          1 of 1 people found this helpful
          • 2. Re: Two-machine deployment issue: PHP on worker can't see databases on master



            Just spent a week trying to debug same issue before landing on this post.


            Indeed, the two-machine deployment scenario causes the 'hostspec' property definition to break what was working ok on a single machine deployment.


            Would definitely love to hear more from FM inc. on the matter


            Thanks Barbara