Jump to content

Need help figuring out what the heck I'm doing (FM + PHP)


This topic is 4643 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hello,

I got tasked with a project utilizing FileMaker.. and my knowledge and experience with FileMaker is *very* limited (so this is also a learning experience for me).

There's a FileMaker server located on a box on this non-profits networking (they insist on hosting the database themselves.. no big deal). They then created an website using some CMS (no clue which or what.. maybe home brew because it's pretty ugly in some aspects of the coding). They want to access the FileMaker database from the remote website which is hosted by another company.

So far via all my research and reading, I figured out they didn't have the FileMaker.php in the PHP.ini include_path. I fixed that. Now since I'm not sure what on their website actually utilizes the database connection (besides the "SEARCH" box which is broken anyhow), I tried to find some sample code on here to figure out if the connection is working or what else needs to be done. The bad part is the company hosting the website part doesn't natively support filemaker an all that.

I tried this code found here to try to generate *something*:


 

<?php

require("./library/database/FileMaker.php");

$fm = new FileMaker("CMS_(dbname)", "iforms.(website)", "(login)","(password)");

 

$dbs = $fm->listDatabases(); /*will work regardless of validity of login */

if (FileMaker::isError($dbs)) { /*can't connect to server*/

        echo $dbs->getMessage();

        exit;

} 

echo"

";

print_r($dbs);

echo "

";

 

$layouts = $fm->listLayouts();

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

        /*can't connect to database generally returns a 401 for invalid or unauthorized login*/

        echo $layouts->getMessage();

        exit;

}

echo"

";

print_r($layouts);

echo "

";

 

$page = $fm->getLayout("myLayout");

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

        /*can't find layout generally returns  "Layout is Missing"*/

        echo $page->getMessage();

        exit;

}

echo"

";

print_r($page->listFields());

echo "

";

?>



 

I figured it would at least give me an error or something.. but *nothing*. (of course I changed all of the database connection information and also pointed the FileMaker.php line to the actual location of the FileMaker.php.. ./library/database/FileMaker.php)

 

The page comes up blank. Completely blank.

 

I also found reference to trying the internet address of your FM server with /fmi/xml/fmresultset.xml

 

Here are the results. 

 



<fmresultset xmlns="http://www.filemaker.com/xml/fmresultset" version="1.0">[indent=1]

<error code="958"/>

<product build="03/02/2011" name="FileMaker Web Publishing Engine" version="11.0.3.302"/>

<datasource database="" date-format="" layout="" table="" time-format="" timestamp-format="" total-count="0"/>

<metadata/>

<resultset count="0" fetch-size="0"/>[/indent]

</fmresultset>

Not having access to all that I really need to check deeper, I'm not sure if the PHP option in the FileMaker server is checked or whatever.. and also I've read about the WPE.. does that need to be installed on the website server along with the filemaker api, or does that run on the same box as the filemaker server? (From what I've read it kind of sounds like you'll have the FileMaker server on one box with PHP access enabled, and on the other box you'd have the webserver, filemaker api to php, and also the WPE).

Coming from a MySQL/PHP world, trying to get the FileMaker stuff working just seems a bit crazy, but then again I've never done it before so I'm sure I'm making it out to be worse than it is.

If anyone can provide the info on the WPE and maybe a *simple* php page that will let me know if the FileMaker.php api is working and also one to actually *show* me if the database connection is working or not would be GREAT!. Like I said, with the code up at the beginning I'm only getting a completely blank page (as if you had put <?php ?> into a file and pointed your browser at it.

Thanks again!

Link to comment
Share on other sites

If the page is coming up completely blank it's probably not a filemaker issue..

Try chucking an echo above your require statement and then running.

Then try chucking an echo below your require statement and the running.

Link to comment
Share on other sites

This topic is 4643 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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