7 Replies Latest reply on Nov 28, 2012 10:58 AM by val360fba

    PHP problem with FMP Advanced 10



      PHP problem with FMP Advanced 10


      Very basic connection problem...


      I've followed the tutorials when setting FMPHP in FMPA10 to the same user I used in PHP, but it always says this:

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


      I put both the FileMaker.php and the .pf7 files in the PHP server. Could someone tell why it doesn't work? Thanks

        • 1. Re: PHP problem with FMP Advanced 10

          Meng Cao:


          Thank you for your post.


          At what point does the Communication Error appear?  That is, just loading the file?  Accessing the file?  Go into Preview?  The exact steps to duplicate the problem would be helpful.



          FileMaker, Incn 

          • 2. Re: PHP problem with FMP Advanced 10

            Thank you for your reply


            This is the code I use:

            require_once ('FileMaker.php');


            $fm = new FileMaker('test001.fp7', '', 'Admin', '');

            $databases = $fm->listDatabases();


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






             I have also tried other methods besides listDatabases() such as $fm->listLayouts(), but they all encountered the same error code 22.


            • 3. Re: PHP problem with FMP Advanced 10

              Meng Cao:


              Thank you for the additional information.


              Do any of the API examples work?  (Be sure to copy these to the web server root folder.)


              How about:

              $fm = new FileMaker();

              $databases = $fm->listDatabases();


              This returns a listing of databases on the server without any other attributes.


              If this still doesn't work, then it appears the Web Publishing Engine or the Server wasn't set up properly.  Please review.



              FileMaker, Inc. 

              • 4. Re: PHP problem with FMP Advanced 10
                   Yes I just figured out that I didn't put the APIs in the include path of PHP. Now everything goes just fine. Thank you!
                • 5. Re: PHP problem with FMP Advanced 10

                       Hello I'm getting this error with FileMkaer Server 12.

                       I've tried listing databases, that works fine. I get the error when I try to retrieve container data, here is my code:


                  require_once ('FileMaker.php');
                  define ('FM_HOST', 'XXX.XXX.XXX.XXX');
                  define ('FM_FILE', 'file.fmp12');
                  define ('FM_USER', 'user');
                  define ('FM_PASS', 'pass');
                  $fm = & new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS);
                  $id = $_REQUEST['id'];
                  if (empty($id)) {
                      die("Invalid id");
                  $record = $fm->getRecordById("NHP Documents", $id);
                  echo "found the record";
                  $container = $record->getField("CONT: Document");
                  echo "got a container ref.";
                  $data = $fm->getContainerData($container);
                  // ERROR OCCURS AFTER THIS CALL
                  echo "Fetched data";
                  function checkError($result)
                      if( $result instanceof FileMaker_Error )
                          die( "

                  Error: " . $result->getMessage() . "

                  " );     } } ?>
                  Please advise.
                  • 6. Re: PHP problem with FMP Advanced 10

                         I suggest starting a new thread instead of adding to one that is more than two years old. It refers to a different version of the software and threads this old don't automatically appear in the Recent Items list and thus are easily missed.