DanBrill Posted September 8, 2004 Posted September 8, 2004 Hey, I've got a problem with getting FX.php to work right on a new machine I'm trying to get it set up on. I'm running PHP 5 on WinXP using IIS as the server. Using FMP 6.0.4. for testing purposes. Basic PHP scripts are running fine, and a url such as http://127.0.0.1:591/FMPro?-format=-fmp_xml&-dbnames returns the xml output from FileMaker that I'm expecting. So I'm pretty sure that IIS, PHP, and FM are all set up right. I've got FX in a folder in my web root. (I've actually tried this two way. I've used FX 2 and FX 3. FX 2 was the most recent release of FX until a few days ago. FX 3 was released by Chris Hansen very recently -- Aug 30th I think. In either case, I'm coming up with the same problem.) Suppose I have code like this: <html> <head> <title>Most Basic FX Test</title> </head> <body> <?php include ("./FX/FX.php"); $FMAddress = "127.0.0.1"; $FMPort = "591"; $request = new FX ($FMAddress, $FMPort); $result = $request ->FMDBNames(); print_r($result); ?> </body> </html> When I call this from a browser it runs for 30 seconds and then I get the following: 0Drawings.fp5Businesses.fp5Jobs.fp5Users.fp5 Fatal error: Maximum execution time of 30 seconds exceeded in c:InetpubwwwrootWSWebFXFX.php on line 412 I don't know what the leading zero refres to. The file names are the 4 FM files that I have open, so this much is good. Line 412 of FX.php (version 2) is if (!curl_exec($curlHandle)) { die($this->ErrorHandler("could not open XML input")); } If I run this using FX ver 3, I get the same error, referring to line 441 of FX.php (version 3). if (! curl_exec($curlHandle)) { return new FX_Error("cURL could not retrieve Post data in RetrieveFMData(). A bad URL is the most likely reason."); } So it looks like there is some problem with the curl extension. In c:windowsphp.ini I have un-commented line 556: extension=php_curl.dll In line 450 of php.ini I have set the following: extension_dir = "./ext" which should be telling php that php_curl.dll is in c:phpext , which is where it is. So I'm stuck. This is, as far as I can tell, the exact same configuration that I'm running on my home machine, and it works fine there. But when I get into the office and try to set it up on my machine here, it just doesn't work. Thanks for any advice. Dan
Garry Claridge Posted September 8, 2004 Posted September 8, 2004 I know nothing about FX however, some about php and xml. The "0" is the result status - meaning all is fine : How does it perform if you comment-out the lines in the FX.php file? Do you have to "close" the connection at any stage? Good Luck. Garry
DanBrill Posted September 8, 2004 Author Posted September 8, 2004 Hi Garry, Thanks for your response. If I comment out those lines it returns an array of errors specific to FX, but nothing that seems to help me. I don't need to close any connections or file handles (that I know of). I'm pretty sure this is an FX problem. I just don't know what. Thanks again, Dan
cellmaker Posted September 10, 2004 Posted September 10, 2004 Dan - Am just getting going with FX as a possible method for dealing with 7 Advanced. As have you, I'm trying some experiments with 6.0v4. I have used PHP with MySQL in the past, and I'm trying to get my mind around how FX is parsing the exported XML data, but this will come in time. For now, I'm just wondering about some of the basics. So I'm going to throw a few question at you in hopes you can help me separate the forest from the trees. I copied your code, changing my port to 90, as I have set it up in the Web Companion. I do not have IWP turned on, by the way. I have no idea how this affects things as yet. Anyway, I'm aiming at 127.0.0.1, which, alone, will return my apache default page. That folder is [Root]/Library/WebServer/Documents. In this folder I've put FX, as well as a file I'm calling fxdefault.php, which is basically your copied code. I changed my default server IP and port info in server_data.php to 127.0.0.1 and 90, respectively. (If I aim at 127.0.0.1:90, it will dutifully return my default page within Root/Applications/FM6/Web, but if I try to call any php files put in that folder, PHP ignores them, so I I moved FX et alia into my usual apache web folder, where php apparently expects to find things. But I digress.) When I aim at 127.0.0.1/fxdefault.php, PHP dutifully returns: Array ( [data] => Array ( [0.0] => Array ( [DATABASE_NAME] => Array ( [0] => Tester.fp5 ) ) [0.1] => Array ( [DATABASE_NAME] => Array ( [0] => Book_List.fp5 ) ) [0.2] => Array ( [DATABASE_NAME] => Array ( [0] => Phonebook ) ) ) [linkNext] => /fxdefault.php?skip=0& [linkPrevious] => /fxdefault.php?skip=0& [foundCount] => 3 [fields] => Array ( [0] => Array ( [emptyok] => NO [maxrepeat] => 1 [name] => DATABASE_NAME [type] => TEXT [extra] => ) ) => http://127.0.0.1:90/FMPro?-db=&-format=-fmp_xml&-max=&-dbnames [query] => [errorCode] => 0 [valueLists] => Array ( ) ) so I'm assuming something good is happening. From this, you can see that Tester.fpg, Book_List.fp5, and Phonebook.fp5 are being recognized. Phonebook.fp5 is not in that folder, by the way, which suggests that an FM file can be basically anywhere, so long as it's open. What I can't get to work, however, is the example Book List file. When I aim at 127.0.0.1/FX/index.php, the php works, but no records are returned from the database. I get the appropriate HTML, which is the searchable form, but no data are being returned. I get no errors, by the way. Submitting a search on the form just returns the form as before. So, from your stolen code, php is able to grab something from FM via FX and return it, but I don't seem to be getting a proper hook into the Book_list file. Given the section of the returned array that says => http://127.0.0.1:90/FMPro?-db=&-format=-fmp_xml&-max=&-dbnames [query] => [errorCode] => 0 [valueLists] => Array ( ), perhaps my files need to be back in the FM6 folder? Can you tell me what I'm doing wrong, or perhaps generally suggest ways in which I can move forward? I still need to mentally parse out what's happening with the xml--> FX array, but I'll get to that in due course. Or perhaps I'm more confused than I first thought. Thanks in advance.
cellmaker Posted September 10, 2004 Posted September 10, 2004 Well, that was interesting. I didn't notice that all of the references to the file in FX/index.php were to Book_List.fp7. Changing the refs in index.php and detail.php to .fp5 solved that problem. As if by magic. Anyway, sorry if you read through that lengthy mess above. I now get to figure out what else is going on in this creature, but it works for the moment. Geez. c
DanBrill Posted September 11, 2004 Author Posted September 11, 2004 Hey Charlie, Thanks for your thorough review of my problem. I haven't played with the FX example files, so I can't really speak to that, but it sounds like you've got that worked out. Also, since my code worked for you, and it worked for me at home, I think I must have some other network issue going on at the office. This at least gives me a place to start looking. But FM7SA has been ordered, so I'll probably wait until I have that installed and my web dev. switched to that before I dig too much deeper. As for how FX parses the xml, I don't really know yet, and I'm not really sure I care that much at this point. When I do have it working it is giving me exactly what I want in an easy-to-program way. It would take me much, much longer to come up with the proper xslt's to translate the xml. Kudos to Chris Hansen. Thanks, Dan
Zero Tolerence Posted September 30, 2004 Posted September 30, 2004 Strange when I try your "Most basic FX Test" I get a horde of errors. Of course, i'm using FMS7A. But I have changed things and made everything right (IP and Port) Check this out and tell me what ya think. FX_Error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024 => 100 [message] => FX: ExecuteQuery XML error: Mismatched tag at line 11 [userinfo] => [backtrace] => Array ( [0] => Array ( [file] => C:InetpubwwwrootFXFX.php [line] => 869 [function] => FX_Error [class] => FX_Error [type] => -> [args] => Array ( [0] => ExecuteQuery XML error: Mismatched tag at line 11 ) ) [1] => Array ( [file] => C:InetpubwwwrootFXFX.php [line] => 1051 [function] => ExecuteQuery [class] => FX [type] => -> [args] => Array ( [0] => -dbnames ) ) [2] => Array ( [file] => C:InetpubwwwrootFXFX.php [line] => 1127 [function] => FMAction [class] => FX [type] => -> [args] => Array ( [0] => -dbnames [1] => 1 [2] => full ) ) [3] => Array ( [file] => C:Inetpubwwwrootshowall.php [line] => 19 [function] => FMDBNames [class] => FX [type] => -> [args] => Array ( ) ) ) [callback] => ) Any idea what the heck that is referring to?
DanBrill Posted October 5, 2004 Author Posted October 5, 2004 I have no idea. The good news is that once I loaded FM7SA I've been able to get everything working as needed at home and at work. So I probably won't worry about what was going wrong now that the point is moot for me. (Kinda like when I was 20, the notion that I could vote, be drafted into the army, get married, etc. but still couldn't buy beer struck me as incredibly unjust. Once I was 21 it was still unjust. I just didn't care about the injustice as much.)
bruceR Posted October 15, 2004 Posted October 15, 2004 Yes, there are quite a few frustrating problems with the example files that come with FX. They don't work. For instance, ALL the files are in the FX folder. But the example are writtten to refer to a subfolder, for instance the line in the file index.php: include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/FX/FX.php"); If index.php remains inside the FX folder this line and similar lines need to be rewritten like this: include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "FX.php");
Atalanta Posted February 11, 2005 Posted February 11, 2005 I'd like to thank DanBrill for that wonderful piece of code (because I'd been banging my head with not getting anything from FMP). This little piece of code told me that I did have the connection working (since I got back the "same" as everyone else). Now it's just a matter of getting it to work "right". (hey, I'd been trying to figure this out all wek...)
Recommended Posts
This topic is 7294 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 accountSign in
Already have an account? Sign in here.
Sign In Now