3 Replies Latest reply on Jul 23, 2013 8:40 AM by mdiehr

    PHP API with OS X 10.6.8 and Filemaker Server Advanced 11

    mdiehr

      I'm having a heck of a time getting the PHP API working on a server that's running OS X 10.6.8.

       

      I can get PHP to work, and I can get FileMaker.php to load. However when I try a simple command such as

       

       




      $dbs = $fm->listDatabases();

      if (FileMaker::isError($dbs)) {

      echo "<p>FM PHP API Error listing databases: " . $dbs->getCode() . " : " . $dbs->getMessage() . "</p>";
      exit;

      }

       

       


      I end up getting

       

      FM PHP API Error listing databases: -1 : Unknown error.

       

       

      The version of PHP seems to be 5.3.8, which is odd, since this page: http://help.filemaker.com/app/answers/detail/a_id/6508/~/supported-php-versions suggests I should only be running 5.3.0

       

      I'm running the lastest FileMaker Server Advanced 11.0.5.510.

       

      Any ideas?

        • 1. Re: PHP API with OS X 10.6.8 and Filemaker Server Advanced 11
          mdenyse

          Can you show us the complete code? What you showed doesn't include the call to new FileMaker(). Perhaps that's missing or the parameters you're passing aren't a valid file/host/username/password.

           

          Running PHP 5.3.8 is fine - it simply has more bug fixes than the stock 5.3.0 does.

          • 2. Re: PHP API with OS X 10.6.8 and Filemaker Server Advanced 11
            mdiehr

            Here's the actual code, which I've basically copied from the example file.

             

            I've verified that:

             

            * PHP publishing is enabled

            * at least one of the databases on my server has the fmphp extended privilege, and that it's available on a guest account (no username or password required).

             

             

            <?php

             

              error_reporting(E_ALL); // all errors

              require_once ('FileMaker.php');

              $host='http://127.0.0.1';

              $fm = new FileMaker();

              $fm->setProperty('hostspec', $host);

              if (FileMaker::isError($fm)) {    

                echo "<p>FM PHP API Error getting filemaker object: " . $fm->getMessage() . "</p>";

                exit;

              }

             

              $dbs = $fm->listDatabases();

              if (FileMaker::isError($dbs)) {    

                echo "<p>FM PHP API Error listing databases: " . $dbs->getCode() . " : " .  $dbs->getMessage() . "</p>";

                exit;

              }

            • 3. Re: PHP API with OS X 10.6.8 and Filemaker Server Advanced 11
              mdiehr

              Problem Solved!

               

              I neglected to mention that I have this server set up with a SSL certificate - I had thought that since I was testing over HTTP rather than HTTPS that it wouldn't matter, but apaprently it does.

               

              The solution (For FileMaker Server Advanced 11 running on OS X 10.6.8)

              1. Open the FileMaker Server Admin Console
              2. Click the "Edit Server Deployment" link.  This should take you to step 4, "Enable Web Publishing". 
              3. Click the "Next" button and make sure you are happy with the options selected
              4. You will get to "Step 5 : Configure Machines", click Next and it should say "The following web server has been located: Apache"
              5. Go to System Preferences, Sharing, and turn Web Sharing OFF.   This step is key.
              6. Go back ro FileMaker Server Admin and click "Next".   You should get the "Web Server Test Failed" screen which has options for selecting the protocol (HTTP or HTTPS, the Host, and the Port #) used to connect FileMaker to the Web Server.   In my case, I chose the following settings:   Protocol: HTTPS, Host: 127.0.0.1, Port: 443.
              7. Go to System Preferences, Sharing, and turn Web Sharing back ON.
              8. Go back to FileMaker Server Admin and click "Retry".  
              9. With luck, it will now detect the SSL server and set up FileMaker properly to use SSL.