Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Unknonw error when using PHP API Find

Featured Replies

  • Newbies

I'm having a problem getting the function call for newFindCommand to do what I'm expecting.

I am fairly new to the API, so I might have missed something elementary. I will provide a brief run-down of steps I took to setup my script.

I have a table called "Family" which has a corresponding layout "web_Family". This table has a primary key: zkp_serial. My database file is called "Goodyear.fp7"

I am serving this file with FM Server 9, have enabled the account Admin account for [Full Access] privilege set. Under the [Full Access] privilege set, I have enabled "Access via PHP web publishing - FMS only (fmphp)".

When I go to configure this database via the Server Admin java-based utility, it has PHP enabled for this file (as well as IWP, XML, XSLT, and all the others).

I'm trying to perform a basic find on this table for one record, a record that has a zkp_serial value of "FM002269" -- the primary key of the record I'm looking for.

This is my php code. Note that FM_DB_USER and FM_DB_PASS set as define() variables in the init.php file. I have obscured the address of the server, the rest of the code is as it is in my development files.


<?php



include "../config/init.php";



include "../lib/FMIAPI/FileMaker.php";



$fmobj = new FileMaker('Goodyear', 'myserver.domain.com', FM_DB_USER, FM_DB_PASS);

print "version: " . $fmobj->getAPIVersion() . "

";



$findobj =& $fmobj->newFindCommand('web_Family'); 



$findobj->addFindCriterion("zkp_serial", "FM002269"); 



$result = $findobj->execute(); 

print $result->getMessage();



print "

";
print_r($result); print ""; ?>








And here's the output by the API engine, showing first "Unknown error" when get use getMessage(), then showing a slightly cryptic response by the engine. Any ideas what I should try next or what this output means?



What does the PEAR_error mean? I don't know what that's about



Any thoughts or tips as to what I haven't tried or should double check greatly appreciated. 













version: 1.0

Unknown error



FileMaker_Error Object

(

    [_fm] => FileMaker_Implementation Object

        (

            [V73ee434e] => Array

                (

                    [charset] => utf-8

                    [locale] => en

                    [logLevel] => 3

                    [hostspec] => myserver.domain.com

                    [recordClass] => FileMaker_Record

                    [prevalidate] => 

                    [database] => Goodyear

                    [username] => Admin

                    [password] => password

                )



            [Vea4b3413] => 

            [Vff1d7746] => 

            [V9a3dcbce] => -628020

        )



    [error_message_prefix] => 

    [mode] => 1

    [level] => 1024

    [code] => -1

    [message] => 

    [userinfo] => 

    [backtrace] => Array

        (

            [0] => Array

                (

                    [file] => /Users/jason/Sites/Goodyear_development/lib/FMIAPI/FileMaker/Error.php

                    [line] => 50

                    [function] => PEAR_Error

                    [class] => PEAR_Error

                    [type] => ->

                    [args] => Array

                        (

                            [0] => 

                            [1] => -1

                        )



                )



            [1] => Array

                (

                    [file] => /Users/jason/Sites/Goodyear_development/lib/FMIAPI/FileMaker/Implementation/Parser/FMResultSet.php

                    [line] => 48

                    [function] => FileMaker_Error

                    [class] => FileMaker_Error

                    [object] => FileMaker_Error Object

 *RECURSION*

                    [type] => ->

                    [args] => Array

                        (

                            [0] => FileMaker_Implementation Object

                                (

                                    [V73ee434e] => Array

                                        (

                                            [charset] => utf-8

                                            [locale] => en

                                            [logLevel] => 3

                                            [hostspec] => myserver.domain.com

                                            [recordClass] => FileMaker_Record

                                            [prevalidate] => 

                                            [database] => Goodyear

                                            [username] => Admin

                                            [password] => password

                                        )



                                    [Vea4b3413] => 

                                    [Vff1d7746] => 

                                    [V9a3dcbce] => -628020

                                )



                            [1] => 

                            [2] => -1

                        )



                )



            [2] => Array

                (

                    [file] => /Users/jason/Sites/Goodyear_development/lib/FMIAPI/FileMaker/Implementation/CommandImpl.php

                    [line] => 84

                    [function] => parse

                    [class] => FileMaker_Parser_FMResultSet

                    [object] => FileMaker_Parser_FMResultSet Object

                        (

                            [Vcb5e100e] => -1

                            [Vf5bf48aa] => Array

                                (

                                    [build] => 06/13/2007

                                    [name] => FileMaker Web Publishing Engine

                                    [version] => 9.0.1.74

                                )



                            [V1ea7e575] => Array

                                (

                                    [database] => 

                                    [date-format] => 

                                    [layout] => 

                                    [table] => 

                                    [time-format] => 

                                    [timestamp-format] => 

                                    [total-count] => 0

                                )



                            [V9f81f3c0] => Array

                                (

                                )



                            [Vaae0d98d] => Array

                                (

                                    [count] => 0

                                    [fetch-size] => 0

                                )



                            [Vae581270] => Array

                                (

                                )



                            [V6e52c40b] => Array

                                (

                                )



                            [Ve13f1c92] => 

                            [V43432a31] => 

                            [V51bc3e3b] => 

                            [V26005321] => 

                            [V6468d939] => 

                            [_fm] => FileMaker_Implementation Object

                                (

                                    [V73ee434e] => Array

                                        (

                                            [charset] => utf-8

                                            [locale] => en

                                            [logLevel] => 3

                                            [hostspec] => myserver.domain.com

                                            [recordClass] => FileMaker_Record

                                            [prevalidate] => 

                                            [database] => Goodyear

                                            [username] => Admin

                                            [password] => password

                                        )



                                    [Vea4b3413] => 

                                    [Vff1d7746] => 

                                    [V9a3dcbce] => -628020

                                )



                            [V5431b8d4] => Resource id #35

                            [V6de51026] => 

                            [_result] => 

                            [_layout] => 

                        )



                    [type] => ->

                    [args] => Array

                        (

                            [0] => 

                        )



                )



            [3] => Array

                (

                    [file] => /Users/jason/Sites/Goodyear_development/lib/FMIAPI/FileMaker/Implementation/Command/FindImpl.php

                    [line] => 43

                    [function] => _getResult

                    [class] => FileMaker_Command_Implementation

                    [object] => FileMaker_Command_Find_Implementation Object

                        (

                            [_findCriteria] => Array

                                (

                                    [zkp_serial] => FM002269

                                )



                            [Vd65662c5] => Array

                                (

                                )



                            [Va9136a07] => Array

                                (

                                )



                            [Vf951bdce] => 

                            [V83f28691] => 

                            [V85fd701e] => 

                            [V6da136ea] => 

                            [V568aa2ec] => 

                            [_fm] => FileMaker_Implementation Object

                                (

                                    [V73ee434e] => Array

                                        (

                                            [charset] => utf-8

                                            [locale] => en

                                            [logLevel] => 3

                                            [hostspec] => myserver.domain.com

                                            [recordClass] => FileMaker_Record

                                            [prevalidate] => 

                                            [database] => Goodyear

                                            [username] => Admin

                                            [password] => password

                                        )



                                    [Vea4b3413] => 

                                    [Vff1d7746] => 

                                    [V9a3dcbce] => -628020

                                )



                            [_layout] => web_Family

                            [V7a2db0ea] => 

                            [_script] => 

                            [_scriptParams] => 

                            [_preReqScript] => 

                            [_preReqScriptParams] => 

                            [_preSortScript] => 

                            [_preSortScriptParams] => 

                            [V0b9a204c] => FileMaker_Record

                            [_recordId] => 

                        )



                    [type] => ->

                    [args] => Array

                        (

                            [0] => 

                        )



                )



            [4] => Array

                (

                    [file] => /Users/jason/Sites/Goodyear_development/lib/FMIAPI/FileMaker/Command.php

                    [line] => 126

                    [function] => execute

                    [class] => FileMaker_Command_Find_Implementation

                    [object] => FileMaker_Command_Find_Implementation Object

                        (

                            [_findCriteria] => Array

                                (

                                    [zkp_serial] => FM002269

                                )



                            [Vd65662c5] => Array

                                (

                                )



                            [Va9136a07] => Array

                                (

                                )



                            [Vf951bdce] => 

                            [V83f28691] => 

                            [V85fd701e] => 

                            [V6da136ea] => 

                            [V568aa2ec] => 

                            [_fm] => FileMaker_Implementation Object

                                (

                                    [V73ee434e] => Array

                                        (

                                            [charset] => utf-8

                                            [locale] => en

                                            [logLevel] => 3

                                            [hostspec] => myserver.domain.com

                                            [recordClass] => FileMaker_Record

                                            [prevalidate] => 

                                            [database] => Goodyear

                                            [username] => Admin

                                            [password] => password

                                        )



                                    [Vea4b3413] => 

                                    [Vff1d7746] => 

                                    [V9a3dcbce] => -628020

                                )



                            [_layout] => web_Family

                            [V7a2db0ea] => 

                            [_script] => 

                            [_scriptParams] => 

                            [_preReqScript] => 

                            [_preReqScriptParams] => 

                            [_preSortScript] => 

                            [_preSortScriptParams] => 

                            [V0b9a204c] => FileMaker_Record

                            [_recordId] => 

                        )



                    [type] => ->

                    [args] => Array

                        (

                        )



                )



            [5] => Array

                (

                    [file] => /Users/jason/Sites/Goodyear_development/inc/test_2.php

                    [line] => 17

                    [function] => execute

                    [class] => FileMaker_Command

                    [object] => FileMaker_Command_Find Object

                        (

                            [_impl] => FileMaker_Command_Find_Implementation Object

                                (

                                    [_findCriteria] => Array

                                        (

                                            [zkp_serial] => FM002269

                                        )



                                    [Vd65662c5] => Array

                                        (

                                        )



                                    [Va9136a07] => Array

                                        (

                                        )



                                    [Vf951bdce] => 

                                    [V83f28691] => 

                                    [V85fd701e] => 

                                    [V6da136ea] => 

                                    [V568aa2ec] => 

                                    [_fm] => FileMaker_Implementation Object

                                        (

                                            [V73ee434e] => Array

                                                (

                                                    [charset] => utf-8

                                                    [locale] => en

                                                    [logLevel] => 3

                                                    [hostspec] => myserver.domain.com

                                                    [recordClass] => FileMaker_Record

                                                    [prevalidate] => 

                                                    [database] => Goodyear

                                                    [username] => Admin

                                                    [password] => password

                                                )



                                            [Vea4b3413] => 

                                            [Vff1d7746] => 

                                            [V9a3dcbce] => -628020

                                        )



                                    [_layout] => web_Family

                                    [V7a2db0ea] => 

                                    [_script] => 

                                    [_scriptParams] => 

                                    [_preReqScript] => 

                                    [_preReqScriptParams] => 

                                    [_preSortScript] => 

                                    [_preSortScriptParams] => 

                                    [V0b9a204c] => FileMaker_Record

                                    [_recordId] => 

                                )



                        )



                    [type] => ->

                    [args] => Array

                        (

                        )



                )



        )



    [callback] => 

)



  • Author
  • Newbies

As luck would have it, I have fixed my own problem. The FM 9 Server itself is having an intermittent problem where the Web Publihsing engine will show red (for error) in the Server admin utility (although all services, PHP, IWP, XML, XSLT, will say "ON"... odd) and display a message "There was an error communicating with the web server engine." (I think that's close to the message... I forgot to write it down).

In any case, this seems to happen to my sever when I leave it running for a while. When I restart the server, all FileMaker systems went to green and the odd behavior changed and the "Unknown error" went away. I am now getting the result I was expecting from the PHP script.

Have you applied the FMS v9.02 patch yet?

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.