Jump to content

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

Recommended Posts

Posted

Hi Everyone,

After a discussion on another section of this forum I decided to have a go at using php on a test webserver, but I'm not having much success.

As far as I can tell php is installed and working properly, because I get a pretty page full of info when I execute a test.php file containing:

<? phpinfo(); ?>

I then downloaded FX and I now have the FX folder sitting under my www folder (this is an IIS5 server by the way).

I configured server_data.php with my filemaker servers (fm5.5, not unlimited) IP address and port.

On my filemaker machine I have opened the sample Book_List.fp5 provided with FX, and I've verified it is being served via IWP.

Finally to test, I entered http://localhost/FX on the webserver.

The initial result is error 403 you are not authorized to view this page.

So I thought maybe the url really needs to be http://localhost/FX/index.php, and the result then appears to be a blank page, until I view source and then I get:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>

<BODY></BODY></HTML>

I don't know where that's come from - the index.php file contains similar text, but its not exactly the same (4.01 for example).

I get the same thing if I try http://localhost/FX/FXExamples.php

Logs for the webserver look normal; filemaker doesn't log anything so I assume I'm not getting as far as the filemaker server; I have no idea if PHP does logging, or where I'd find the files.

The only strange thing I noticed during setting up is that all the text files that have come with FX don't look good in notepad - its all one line seperate by little box characters. Opening them in wordpad looks fine, but I don't want to save them after doing that in case it changes something.

Having pretty close to zero experience with PHP I'm hoping someone out there can point me in the right direction...

Thanks... Sean!

Posted

Hi Garry,

Just tried that... no change.

Any other ideas?

The version of PHP is 5.0.1 - is anyone else using that version?

I'm clutching at straws a bit but maybe something has changed since v4 and its not compatible?

Cheers... Sean!

Posted

Here is some php that you can use without using FX.

Here is a script called "fmpro.php":

<?php 

if ($_SERVER["QUERY_STRING"] != "") 

{ 

@include("http://localhost:591/FMPro?" . $_SERVER["QUERY_STRING"]); 

} 

else 

{ 

$args = ""; 



while ($fm_params = Current($_REQUEST)) 

{ 

$args .= urlencode(key($_REQUEST)) . "=" . urlencode($fm_params) . "&"; 

next($_REQUEST); 

}; 



@include("http://localhost:591/FMPro?" . $args); 



}; 

?>


You could use a Form like this:


<body> 

Hello World<br> 

<form action="fmpro.php" method="POST"> 

<input type="hidden" name="-db" value="combotest.fp5"> 

<input type="hidden" name="-format" value="-fmp_xml"> 

<input type="submit" name="-new" value="New Rec"> 

</form></body>

Hope that this is of interest.

Garry

Posted

Hi Garry,

I tried your code and the result was a simple HTML page with Hello World and a button labelled New Rec.

This is a direct copy of the source code (filename = test.html):

<body>

Hello World<br>

<form action="fmpro.php" method="POST">

<input type="hidden" name="-db" value="Book_List.fp5">

<input type="hidden" name="-format" value="-fmp_xml">

<input type="submit" name="-new" value="New Rec">

</form></body>

Hitting that button returns page cannot be found error.

Both files are in the root level of my server (www) and I entered http://localhost/test.html to access it.

The code for the fmpro.php is:

<?php

if ($_SERVER["QUERY_STRING"] != "")

{

@include("http://10.50.60.2:80/FMPro?" . $_SERVER["QUERY_STRING"]);

}

else

{

$args = "";

while ($fm_params = Current($_REQUEST))

{

$args .= urlencode(key($_REQUEST)) . "=" . urlencode($fm_params) . "&";

next($_REQUEST);

};

@include("http://10.50.60.2:80/FMPro?" . $args);

};

?>

On the other hand, this code worked (even with IWP enabled):

<html>

<head>

<title>Get File Names</title>

</head>

<body>

<?

include ("FX.php");

$FMAddress = "10.50.60.2";

$FMPort = "80";

$request = new FX ($FMAddress, $FMPort);

$result = $request->FMDBNames();

print_r ($result);

?>

</body>

</html>

So I guess PHP and FX are working properly, but there is something in the example code, and your suggestion, that it doesn't like.

Can you see anything in your code that I've stuffed up? All I really chenged was the IP address of the filemaker server, which is on a different box to the web server...

Thanks for the assist,

Sean.

Posted

To check if CWP is working you could try a URL directly in a browser, for example:

http://10.50.60.2/FMPro?-db=Book_List.fp5&-format=-fmp_xml&-findany

If this returns some data then the php should return data.

Are you using the Web Security database? Is there a permission problem?

Try changing this line in the test file:

<input type="submit" name="-new" value="New Rec">

to

<input type="submit" name="-findall" value="Find Rec">

Good Luck.

Garry

Posted

Hi Garry,

Yes, http://10.50.60.2/FMPro?-db=Book_List.fp5&-format=-fmp_xml&-findany does return data (xml stuff containing info from the database).

No web security database or permission problems I assume since the above works.

Changed that line, and it behaves the same way.

******* this is frustrating....

Posted

Hi again Garry,

Alrighty. A nice simple script, I like it. I have substituted -new instead of -findany because it has a visible effect on the database.

Here's the thing.

If I copy the http part into the address bar, a new record is created in the database and I get xml back at the browser, so filemaker is behaving correctly.

If I run the same line through php the new record is created in the database, but at the browser all I get is that blank page (with html header in source).

Shouldn't I get the same xml stuff back?

Cheers,

Sean.

Posted

I just found I could turn display errors on... wish I knew that earlier!

Anyway, instead of a blank screen, as a result of this (your suggestion):

<?php

include ("http://10.50.60.2/FMPro?-db=Book_List.fp5&-format=-fmp_xml&-new");

?>

I now get this:

Parse error: syntax error, unexpected T_STRING in http://10.19.58.2/FMPro?-db=test.fp5&-format=-fmp_xml&-new on line 1

Have you seen that before?

Thanks, Sean.

Posted

I have :(

It is being upset by the underscore character. It thinks that it is a variable. Try this:

<?php

$data = file_get_contents('http://10.50.60.2/FMPro?-db=Book_List.fp5&-format=-fmp_xml&-findany');

echo $data

?>

Good Luck.

Garry

Posted

Hi Garry,

Starting to belt my head on the desk now :(

As it happens, I have your one-liner working (the original and your above version). I was using the recommended ini file provided with php, but I've changed to the dist version instead. I also disabled short tags and between the two it fixed up that line of code.

So with that working I go back to your html file which posts to fmpro.php... nope still returns a page not found error. I can't understand that at all. Seems like it should be easy to get going.

I think I've just about decided I should uninstall version 5 of PHP and go back to version 4. Possibly a waste of time, but I've already spent 2 solid days and I'm just going around in circles now...

Cheers,

Sean.

Posted

Hmmm.

OK, I just discovered urlscan running on this machine... specifically disallowing POST....

So, now your html code is working!

Progress at last!

Is there some magic to understanding the line numbers given in errors? They never seem to make sense. For example:

Parse error: syntax error, unexpected ';' in D:wwwfxindex.php on line 123

But when I open in a text editor line 123 is only </tr>

With trial and error (adding a line in here and rechecking the line number) it turns out the problem was in line 135. This is what was on the line:

<?php echo // $BookData['currentError']; ?>

Now, I didn't put that there and I just rechecked it in the zipped version. Surely this had caused someone else problems! As soon as I took the // out, the page works (a few notices still, but nothing fatal).

Wierd!

Thanks for your help Garry. I guess PHP and FX are working properly!

  • 2 months later...
Posted

Hi,

I tried this simple code:-

<?php

include_once("/inetpub/wwwroot/FX7/FX.php");

include_once("/inetpub/wwwroot/FX7/server_data.php");

include_once("/inetpub/wwwroot/FX7/FMErrors.php");

$request = new FX ("192.168.10.77", "80");

$result =$request->FMDBNames();

print_r ($result);

?>

But each time I am getting the following error:-

fx_error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024

 => 100 [message] => FX: ExecuteQuery XML error: syntax error at line 1 [userinfo] => [backtrace] => Array ( [0] => Array ( [file] => C:inetpubwwwrootFX7FX.php [line] => 889 [function] => fx_error [class] => fx_error [type] => -> [args] => Array ( [0] => ExecuteQuery XML error: syntax error at line 1 ) ) [1] => Array ( [file] => C:inetpubwwwrootFX7FX.php [line] => 1051 [function] => executequery [class] => fx [type] => -> [args] => Array ( [0] => -dbnames ) ) [2] => Array ( [file] => C:inetpubwwwrootFX7FX.php [line] => 1127 [function] => fmaction [class] => fx [type] => -> [args] => Array ( [0] => -dbnames [1] => 1 [2] => full ) ) [3] => Array ( [file] => C:InetpubwwwrootBuddysystesttest.php [line] => 40 [function] => fmdbnames [class] => fx [type] => -> [args] => Array ( ) ) ) [callback] => ) 

This is not returning any database names.

can u direct me where am I missing something?

Anchal

Posted

Which URL...?I am a newbie to fx.php.

If there is any way to check out whether the settings ,PHP or filemaker database are working then plz help me out.

Plz help me out.

Anchal

Posted

I tried using the URL:-

http://192.168.10.77:591/FMPro?-db=Tester.fp7&-format=-fmp_xml&-new

but got following xml error:-

[color:red]

<?xml version="1.0" encoding="UTF-8" ?>

- <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">

<ERRORCODE>100</ERRORCODE>

<PRODUCT BUILD="5/4/2002" NAME="FileMaker Pro Web Companion" VERSION="6.0v1" />

<DATABASE DATEFORMAT="" LAYOUT="" NAME="tester.fp7" RECORDS="0" TIMEFORMAT="" />

<METADATA />

<RESULTSET FOUND="0" />

</FMPXMLRESULT>

(Note :- the resultset found=0 and records=0)

Does this signify some problem with filemaker database .This database works fine when opened in developer 7 and has 3 records.

Plz help me to get out of this.

Anchal

Posted

This error code:

<ERRORCODE>100</ERRORCODE>

means that the "File is Missing".

Hence, FM seems to be "talking" http on port 591; which is a start.

Try:

http://192.168.10.77:591/FMPro?-dbnames

Garry

p.s. I just noticed that the file "tester.fp7" is FM7 and the WebCompanion is FM6!!!

  • Newbies
Posted

Just a reminder that this step in the configuration of FX.php to get it to work with FM7 is easy to overlook. If not made, it will cause errors similar to those in previous posts.

In the FX.php file, change this line:

var $dataServerType = 'FMPro5/6';

to:

var $dataServerType = 'FMPro7';

This topic is 7374 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.