11 Replies Latest reply on Aug 31, 2013 8:28 AM by steve.winter

    Cannot get FileMaker PHP API correctly configured

    markjulie

      FMSA 12.0.4.405 is installed on OS X Mountain Lion Server on a MacPro with 10.8.4. IWP, PHP, and ODBC are enabled. I can get to the Test Page for PHP which displays its data. I deployed using the FileMaker-supported version of php. I also verified with Apple that php is correctly setup on OS X Server.

       

      After watching Lance Hallberg's "FileMaker and PHP Foundations Course" on vtc.com, I have tried to set the php api permissions correctly and moved the standalone folder from HD/Library/FileMaker Server/Web Publishing to HD/Library/WebServer/Documents. When I send the code:

       

      <?php

      ini_set('display_errors',1);

      require_once('../../FM_API_for_PHP_Standalone/FileMaker.php');

      ?>

       

      I get an error:

      PHP Warning: require_once(../../FM_API_for_PHP_Standalone/FileMaker.php): failed to open stream: No such file or directory in - on line 5 PHP Fatal error: require_once(): Failed opening required '../../FM_API_for_PHP_Standalone/FileMaker.php' (include_path='.:') in - on line 5

      HD/Library/WebServer/Documents/04/0405/0405.php is the path of the php code.

       

      I'm sure there is something simple I missed.


        • 1. Re: Cannot get FileMaker PHP API correctly configured
          databuzz

          Hi,

           

          Can you try this:

           

          require_once('../../../FM_API_for_PHP_Standalone/FileMaker.php');

           

          instead and see if that works.

          • 2. Re: Cannot get FileMaker PHP API correctly configured
            markjulie

            I had tried additional move up one level of the directory before unsuccessfully, and I get the same error again (that I published above). After wasting an expensive hour with an FBA consultant who billed me for attempting unsuccessfully to connect to my server for an hour, they suggested a number of self-service steps for which I also need help and may need to repost:

             

            1. Manually install the FileMaker API for PHP.

            2. Be sure you enable the cURL module in your php.ini file.

            3. Make sure your default location for Mac OS X is /usr/lib/php.

            4. Look at http://www.filemaker.com/support/product/docs/12/fms/fms12_cwp_php_en.pdf

            5. FileMaker.php has to be found by the PHP, so be sure you specify the location of the FileMaker API for PHP in the include_path variable in php.ini.

            6. If you are accessing databases that contain dates and times, install the pear date package. For more information, see: http://pear.php.net/package/date/

             

            I have done 1 and need help with the remainder.

            • 3. Re: Cannot get FileMaker PHP API correctly configured
              mdenyse

              Hi,

               

              Try to eliminate all of the extra stuff and keep it simple for the moment:

               

              1. Copy the FileMaker.php and FileMaker folder into a new directory where your web server documents are served up.

               

              2. Create a test.php file that resides in the same directory as FileMaker.php:

               

              <?php

              include "FileMaker.php";

              $fm = new FileMaker(/* put your server/credentials here */);

              $result = $fm->listDatabases();

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

                 echo 'Oops. Error='. $result->getCode();

              }

              else {

                 foreach ($result as $database) {

                    echo $database ."\n";

                 }

              }

              ?>

               

               

              See if you can run test.php without any errors being generated. That will at least tell you that PHP is running, cURL is installed, and the FileMaker API files can talk to your server. If all is well it'll list the database(s) accessible with those credentials.

               

              While you can 'rely' on the API files being installed on a FileMaker server, you may find that you're running your web pages on a completely different server. I *always* include the API files within my code so I know I've got the files and that it works with a known version. You don't want a server admin changing things without your knowledge and hosing your code!

               

              Good luck.

              • 4. Re: Cannot get FileMaker PHP API correctly configured
                markjulie

                Thanks, Mark. I updated some PHP and PEAR files with Homebrew, but a similar error persists:

                 

                PHP Warning: include(FileMaker.php): failed to open stream: No such file or directory in - on line 2 PHP Warning: include(): Failed opening 'FileMaker.php' for inclusion (include_path='.:') in - on line 2 PHP Fatal error: Class 'FileMaker' not found in - on line 3

                 

                ScreenShot.jpg

                 

                I could use help with the cURL.

                 


                • 5. Re: Cannot get FileMaker PHP API correctly configured
                  jmrusch

                  I'm wondering if the problem is your path.

                   

                  If HD/Library/WebServer/Documents is the root folder, then I create a folder for each related site, for example:

                   

                       HD/Library/WebServer/Documents/Attendance

                   

                  I'd put copies of the FileMaker.php file and FileMaker folders from HD/Library/FileMaker Server/Web Publishing into the Attendance folder. Then I'd have a line like:

                   

                       require_once('FileMaker.php')

                   

                  in my PHP code that needs access to the API.

                   

                  HTH,

                  Julie

                  • 6. Re: Cannot get FileMaker PHP API correctly configured
                    mdenyse

                    Can you post screen shots of what happens when you try to run the test.php script? As Julie Rusch noted, it really looks like your path isn't set right or perhaps the privileges for the FileMaker.php and FileMaker folder are preventing even read access. That might be something to check out, too.

                    • 7. Re: Cannot get FileMaker PHP API correctly configured
                      jmrusch

                      Reviewing my earlier post, I'm not sure if I was as clear as I could have been. Here are a some explicit examples of where files would be located:

                       

                           HD/Library/WebServer/Documents/Attendance/FileMaker.php

                       

                           HD/Library/WebServer/Documents/Attendance/FileMaker/[files in the FileMaker folder]

                       

                      FileMaker.php and the FileMaker folder are the two items that you found in the FM API for PHP Standalone folder.

                       

                           HD/Library/WebServer/Documents/Attendance/att_login.php

                       

                           HD/Library/WebServer/Documents/Attendance/rosters.php     <-- and so on

                       

                       

                      All files that are part of the Attendance solution would be in the Attendance folder; any of them could reference the API by an include or require like that shown in my prior post.

                      • 8. Re: Cannot get FileMaker PHP API correctly configured
                        markjulie

                        Julie (or Mark),

                         

                        I created /Test and moved copies of /FileMaker and Filemaker.php into it with the same error. Here is code for test.php.

                         

                        <?php

                        include "FileMaker.php";

                        $fm = new FileMaker();

                        $fm->setProperty('FMServer_Sample', $databaseName);

                        $fm->setProperty('Admin', $userName);

                        $fm->setProperty('', $passWord);

                        $result = $fm->listDatabases();

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

                           echo 'Oops. Error='. $result->getCode();

                        }

                        else {

                           foreach ($result as $database) {

                              echo $database ."\n";

                           }

                        }

                        ?>

                         

                        Here are permissions:

                        server:Documents markjulieserver$ ls -al

                        total 104

                        drwxr-xr-x+ 24 root  wheel    816 Aug 30 08:42 .

                        drwxr-xr-x   5 root  wheel    170 Dec  9  2012 ..

                        -rw-r--r--@  1 root  wheel  12292 Aug 23 17:30 .DS_Store

                        drwxr-xr-x@  5 root  wheel    170 Aug 17 21:57 01

                        drwxr-xr-x@  9 root  wheel    306 Aug 17 21:57 02

                        drwxr-xr-x@ 11 root  wheel    374 Aug 17 21:57 03

                        drwxr-xr-x@  9 root  wheel    306 Aug 17 21:57 04

                        drwxr-xr-x@ 11 root  wheel    374 Aug 17 21:57 05

                        drwxr-xr-x@ 15 root  wheel    510 Aug 17 21:57 06

                        drwxr-xr-x@  9 root  wheel    306 Aug 17 21:57 07

                        drwxr-xr-x@ 13 root  wheel    442 Aug 17 21:57 08

                        drwxr-xr-x@ 10 root  wheel    340 Aug 17 21:57 09

                        drwxr-xr-x@  6 root  wheel    204 Aug 17 21:57 10

                        drwxr-xr-x@ 11 root  wheel    374 Aug 17 21:57 11

                        drwxr-xr-x@  5 root  wheel    170 Aug 17 21:57 12

                        drwxr-xr-x@  6 root  wheel    204 Aug 17 21:57 13

                        drwxr-xr-x@ 15 root  wheel    510 Aug 17 21:57 14

                        drwxrwxr-x   3 root  wheel    102 Aug 21 22:43 Examples

                        drwxr-xr-x   5 root  wheel    170 Aug 30 08:46 FM_API_for_PHP_Standalone

                        drwxr-xr-x+ 16 root  wheel    544 Aug 19 22:15 PHP API Documentation

                        -rw-r--r--+  1 root  wheel   3726 Dec  9  2012 PoweredByMacOSX.gif

                        -rw-r--r--+  1 root  wheel  31958 Dec  9  2012 PoweredByMacOSXLarge.gif

                        drwxr-xr-x   5 root  wheel    170 Aug 30 08:46 Test

                        -rw-r--r--+  1 root  wheel     44 Aug  6 12:59 index.html.en

                        server:Documents markjulieserver$

                         

                        Here is the persistent error with all files in the same folder with supposedly appropriate permissions:

                         

                        PHP Warning: include(FileMaker.php): failed to open stream: No such file or directory in - on line 2 PHP Warning: include(): Failed opening 'FileMaker.php' for inclusion (include_path='.:') in - on line 2 PHP Fatal error: Class 'FileMaker' not found in - on line 3

                         

                        Still stuck

                        • 9. Re: Cannot get FileMaker PHP API correctly configured
                          ch0c0halic

                          From the description I think that you haven't specified where the "FileMaker.PHP" file is located.

                           

                          Add search locations to the defaults to include the path to these files.

                          It should probably be defined in this file.

                           

                          /etc/apache2/httpd.conf

                           

                          The FMS install modifies this file to add a bunch of code specific to the FM PHP API. The FMS PHP API includes look like this.

                           

                          #FMI_Configuration_V1

                          ##Include '/Library/FileMaker Server/Admin/admin-helper/WEB-INF/conf/fmi-test.conf'

                          #FMI_Configuration_V1

                          ##Include '/Library/FileMaker Server/Admin/admin-helper/WEB-INF/conf/fm-server-status.conf'

                          #FMI_Configuration_V1

                          ##LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so

                          #FMI_Configuration_V1

                          ##Include '/Library/FileMaker Server/Admin/admin-helper/WEB-INF/conf/mod_proxy.conf'

                          #FMI_Configuration_V1

                          ##Include '/Library/FileMaker Server/Web Publishing/publishing-engine/php/lion/httpd.conf.php'

                          #FMI_Configuration_V1

                          Include '/Library/FileMaker Server/Admin/admin-helper/WEB-INF/conf/fmi-test.conf'

                          #FMI_Configuration_V1

                          Include '/Library/FileMaker Server/Admin/admin-helper/WEB-INF/conf/fm-server-status.conf'

                          #FMI_Configuration_V1

                          LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so

                          #FMI_Configuration_V1

                          Include '/Library/FileMaker Server/Admin/admin-helper/WEB-INF/conf/mod_proxy.conf'

                          #FMI_Configuration_V1

                          Include '/Library/FileMaker Server/Web Publishing/publishing-engine/php/lion/httpd.conf.php'

                          • 10. Re: Cannot get FileMaker PHP API correctly configured
                            beverly

                            Hey! Remember to BACKUP a copy of any conf or .ini files before getting in there and making changes!!!  Been there - had to fix others' files when they didn't do this.

                             

                            -- sent from my iPhone4 --

                            Beverly Voth

                            --

                            • 11. Re: Cannot get FileMaker PHP API correctly configured
                              steve.winter

                              Hi

                               

                              Thanks for your email. I'm currently on leave until Monday 9th of September with limited access to

                              email.

                               

                              If your message is urgent, please forward it to support@msdev.co.uk or call +44 777 852 4776.

                               

                              In all other cases I'll reply as soon as I'm able.

                               

                              Cheers

                              Steve