October 4, 201114 yr Hi I have a - Centos Linux Server where php is running fine. (10.1.1.240 - Window Server 2008 where Filemaker Server 11 is installed (10.1.1.201) - Database name is bookstore.fp7 What would be the database connection in php? Thank you
October 4, 201114 yr Set the Extended Privileges in Accounts and Privileges to allow access via php web publishing. The PHP code must have this code: define('FM_HOST', '127.0.0.1');//insert actual servername or IP address define('FM_FILE', 'bookstore'); define('FM_USER', 'username'); //insert actual username define('FM_PASS', 'myPassword'); //insert actual password include('filemaker.php'); //include actual path to filemaker API files $fm=new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS); For more information on interfacing, download the Filemaker Custom Web Publishing Guide
October 4, 201114 yr Author thanks doughemi. Are php codes same as php-mysql if i want to select the table and display data from this FM database?
October 4, 201114 yr Similar but not identical. The Web Publishing Guide defines them. One thing to always bear in mind is that the FileMaker PHP API is focused on layouts, not tables
October 5, 201114 yr Author I am getting error message saying: Error: Communication Error: (7) couldn't connect to host I can successfully ping from the linux host to this FM server. I have used following php script. <?php error_reporting(E_ALL); define('FM_HOST', '10.1.10.231');//insert actual servername or IP address define('FM_FILE', 'questionnaire'); define('FM_USER', 'web'); //insert actual username define('FM_PASS', 'web'); //insert actual password include('FileMaker.php'); //include actual path to filemaker API files $fm=new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS); ?> <?php /** * We need the ID of the 'Active Questionnaire' in the database. * Since there can only be one active questionnaire at a time, * this can be retrieved from the database by using a simple 'find all' command. */ #Create the 'find all' command and specify the layout $findCommand =& $fm->newFindAllCommand('active_Questionnaire'); #Perform the find and store the result $result = $findCommand->execute(); #Check for an error if (FileMaker::isError($result)) { echo "<p>Error: " . $result->getMessage() . "</p>"; exit; } #Store the matching records $records = $result->getRecords(); #Retrieve and store the questionnaire_id of the active questionnaire $record = $records[0]; $active_questionnaire_id = $record->getField('questionnaire_id'); /** * To get the name of the active questionnaire, we can perform another find * on the 'questionnaire' layout using the $active_questionniare_id. */ #create the find command and specify the layout $findCommand =& $fm->newFindCommand('questionnaire'); #Specify the field and value to match against. $findCommand->addFindCriterion('Questionnaire ID', $active_questionnaire_id); #Perform the find $result = $findCommand->execute(); #Check for an error if (FileMaker::isError($result)) { echo "<p>Error: " . $result->getMessage() . "</p>"; exit; } #Store the matching record $records = $result->getRecords(); $record = $records[0]; #Get the 'Questionnaire Name' field from the record and display it echo "<p>Thanks for taking the " . $record->getField('Questionnaire Name') . "</p>"; #Get the 'Description' field from the record and display it echo "<p>Questionnaire Description: " . $record->getField('Description') . "</p>"; ?>
October 5, 201114 yr Make sure port 5003 is open in any firewall between the two servers. Also, your code looks for FileMaker.php in the same directory as the php file (it usually is in a subfolder named "filemaker", so adjust the include() statement accordingly).
October 5, 201114 yr In your original post, you say the Filemaker Server is on 10.1.1.201, but your code says it's on 10.1.10.231 .
October 5, 201114 yr Author on original post i gave some different ip, FM server is 10.1.10.231. FileMaker.php is in the root. FM Server has firewall disabled. There is not firewall between servers. From Linux server I can telnet to FM Server on port 5003.
October 6, 201114 yr Author Hi, My PHP scripts will be in Apache on my Linux Server. I have copied FileMaker API on the root where my php scripts page are. This php page will be accessing database from FileMaker Server. As I will only be accessing database from FileMaker Server, Do I still install/configure CWP on FileMaker server. Isnt CWP must be installed if I want to have php pages on FileMaker Server?
October 7, 201114 yr In order to communicate with FileMaker via its XML engine (which the PHP API does) you MUST install the "Custom Web Publishing Engine" (CWPE) - this component is a connecting service that processes inbound XML over a target web port / path, passes a command or series of commands to FileMaker server which then returns its response to the component which then in turn returns the XML. This is a complete and distinct component of FileMaker needs to be installed regardless of whether your PHP application sits on that server or somewhere entirely different. Components: 1) FileMaker Server 2) FileMaker CWPE 3) Your PHP engine Each component can sit on a separate server though 1+2 are normally located on the same machine.
October 7, 201114 yr Author Hi Genx, To enable the components I started the deployment Assistant selected Yes, enable web publishing ticked XML and PHP (No, use my existing installation of the PHP engine) on Deployment type which one do i select? Single Machine or Two machines. If i select two machines and enter the IP Address of Linux server on Lookup box, there is an error which says "Error encountered while doing lookup"
October 8, 201114 yr Deploy the FileMaker Server and the Web Publishing role to a single machine, the linux box has nothing to do with FileMaker itself and doesn't need to be configured.
Create an account or sign in to comment