7 Replies Latest reply on Jul 12, 2016 6:22 AM by Mike_Mitchell

    PHP OBDC configuration

    Alex.Kovacic

      Hello, I just started working with a company that uses Filemaker Server 14 and was asked to create a web interface for it, I found the PHP API that is provided by Filemaker but as far as I can tell that wont let me query the full database but I'll need to create "views" and look for stuff there, I would much prefer just being able to query the filemaker databases like I do an SQL one, so I looked around and found out that Filemkaer supports ODBC, I downloaded the drivers and isntalled them on the MAC that is used as a server, but I haven't been able to configure them with PHP, it seems that the php version that the webserver is using has been installed by filemaker server and I've been unable to recnfugure it installing more odbc drivers.

       

      Is there a way of configuring them without having to reinstall php?

      I've already tried stuff like this without success:

       

      putenv('ODBCSYSINI=/Libreria/FileMaker Server/HTTPServer/htdocs/include/odbcsys.ini');

      putenv("ODBCINI=/Libreria/FileMaker Server/HTTPServer/htdocs/include/odbc.ini");

       

      where those 2 files are:

       

      odbcsys.ini

       

      [FileMakerODBC]

      Driver = /Libreria/FileMaker Server/HTTPServer/htdocs/include/Contents/MacOS/fmodbc.so

      UsageCount = 1

       

      odbc.ini:

       

      [FMODBC]

      Driver             = FileMakerODBC

      Description        = test

      Database           = Record del personale

      Server             = 127.0.0.1

      Port               = 2399

      UseLongVarchar     =

      AutoDetectEncoding =

      WideAPI            =

      UnicodeTextTypes   =

      MultiByteEncoding  =

      QueryLog_On        =

      QueryLogTime       =

      QueryLogFile       =

       

      ----

       

      Any ideas on what I'm doing wrong?

        • 1. Re: PHP OBDC configuration
          Mike_Mitchell

          Alex.Kovacic wrote:

           

          Hello, I just started working with a company that uses Filemaker Server 14 and was asked to create a web interface for it, I found the PHP API that is provided by Filemaker but as far as I can tell that wont let me query the full database

           

          Hello, Alex. I don't know what led you to the conclusion that you can't query the full database, but perhaps it's an unfamiliarity the the FileMaker paradigm that's causing your confusion.

           

          FileMaker works from the concept of "context", which basically means a layout. A layout is based on a table occurrence (TO) on the Relationships Graph inside the FileMaker database, rather than on a table itself. The PHP API is configured to match this paradigm. So if you want to query a FileMaker database using the PHP API, you first configure the necessary layouts inside the database itself to match what you want to query (or at least the tables / views). You don't use the ODBC drivers or connections for that purpose.

           

          So the short version is, you're reaching around the barn to get to the door. There's no need (or benefit) to mess about with the ODBC drivers to access the FileMaker system via PHP. You work with FileMaker and PHP, and that's all.

           

          If you have more specific questions about how to query something in your database, we can probably help you here. Otherwise, there are a couple of good resources available on the web (both free and for purchase) that document and explain the FileMaker web publishing paradigm. Here are a few:

           

          https://fmhelp.filemaker.com/docs/14/en/fms14_cwp_guide.pdf

          http://cimbura.com/tech/2012/02/28/filemaker-custom-web-publishing/

           

          HTH

           

          Mike

          • 2. Re: PHP OBDC configuration
            BowdenData

            Also have a look at FMWebframe on this page.

             

            http://timdietrich.me/application/projects.php

             

             

            Doug

            • 3. Re: PHP OBDC configuration
              greglane

              Hi Alex,

               

              The FileMaker ODBC driver supports DSN-less connections. Here's some sample code that might help:

               

              $connection = odbc_connect( "Driver={FileMaker ODBC};Server=localhost;Database=FMServer_Sample12;", $user, $pass );

              $statement = 'UPDATE tasks SET "Due Date"="Due Date" + 7 WHERE "Due Date"<?';

              $query = odbc_prepare ($connection, $statement);

              $today = date("Y-m-d");

              $result = odbc_execute($query, array($today));

               

              Make sure you install the FileMaker ODBC driver that matches the architecture of your installation of PHP (32 vs 64 bit).

               

              Greg

              • 4. Re: PHP OBDC configuration
                neutralbay

                Hi Alex,

                I realize this is old, but to reiterate Greg's point, FileMaker can certainly work via ODBC if you have driver set up correctly.

                 

                Contrary to what Mike wrote, ODBC doesn't care about context or layouts, just tables and fields. There is good documentation in their guide on ODBC From FileMaker.

                 

                Lastly, depending on your needs, ODBC can be much faster than using the XML interface (whether you use PHP API or not). That's the reason we use ODBC for 70% of our FileMaker web applications.

                 

                This guide is for 12 but should still be valid. https://www.filemaker.com/support/product/docs/12/fmp/fm12_odbc_jdbc_guide_en.pdf

                 

                Hope this helps.

                 

                Michael

                • 5. Re: PHP OBDC configuration
                  Mike_Mitchell

                  Uh, excuse me, but I never said ODBC works via context or layout. Please read my post again.

                  • 6. Re: PHP OBDC configuration
                    neutralbay

                    Apologies, didn't mean to offend...  I was merely pointing out that ODBC is not layout or context aware, and was referring to your statement:

                    FileMaker works from the concept of "context", which basically means a layout.

                    To someone not familiar with FileMaker, it may not be clear that connecting to FileMaker via ODBC does not work from the concept of "context".

                     

                    Thank you for your kind feedback.

                    • 7. Re: PHP OBDC configuration
                      Mike_Mitchell

                      I said, "read the post", not "read one statement out of context". The OP asked about connecting via the PHP API, under the mistaken impression that ODBC was required. The answer was, no, you do not need ODBC to use the PHP API - in fact, it's not configured for that at all. In addition, the OP was under the impression that it was impossible to query the entire database via the PHP API - another mistaken impression.

                       

                      The point was not that you need context for ODBC. I never said that, contrary to your assertion. The OP was asking about the PHP API, for which context matters.

                       

                      I appreciate your enthusiasm for accurate information. Such enthusiasm should include accuracy when commenting on others' posts.