Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I have tried to configure IIS to work with FX.php. I have downloaded PHP, put it into the root web folder of filemaker, then told IIS to have the default directory of filemaker/web. Then I tell the browser to go to a readme.txt and it displays on the browser. But when I try to view a php file it just tells me to download it. How do I configure php and FX.php to work with IIS?

Thanks.

Justin Grewe

Posted

It is important to distinguish between the FX.php file and the PHP program. The PHP program interprets and executes PHP scripts, where as the FX.php file is just a text file that contains a PHP script. The PHP program interprets and executes the instructions contained in the FX.php script.

I think what you meant is that you've downloaded the FX.php file and placed it in the root web folder. Presumably you have already installed the PHP program separately.

It sounds like you have not configured IIS to forward .php requests to the PHP program. The link below explains carefully how to configure PHP for use with IIS. This is the official documentation, although the instructions on PHP Builder which Leb i Sol posted seem much more easy to follow.

http://www.php.net/manual/en/install.iis.php#install.iis.iis4

To test your installation of PHP, create a one line php script:

phpinfo();

When requested from a browser, it will output the details of your PHP configuration -- this is very handy. Also, it will confirm that PHP is up and running, and working correctly with your server. More than likely you will want to make some adjustments to your PHP config down the road. This can be done by changing the settings in the PHP.ini file, typically located at c:winntphp.ini. There is also another copy of PHP.ini, probably located in your PHP4 intallation folder. This copy is used as a reference, in case you want to go back to default settings.

Once you've configured everything, opening FX.php from a web browser should display in a blank screen. This is because the FX.php doesn't actually do anything on its own. The file merely provides a class that you utilize in your own PHP scripts. Here is an example of how to list all books from the Book_List.fp5 database that comes with the FX.php package:

<?

require_once("FX.php");

$query = new FX("127.0.0.1", "591");

$query -> setDBData("Book_List.fp5", "Detail_View");

$result = $query -> FMFindAll();

foreach ($result["data"] as $row) {

	print ($row["title"][0]."<br>n");

}

?>

This is an interpretation of what that code does:

Line 1:[color:"white"]_____require_once("FX.php");

Load the code from the FX.php file.

Line 2[color:"white"]_____$query = new FX("127.0.0.1", "591");

Create a new variable named $query.

Create a new instance of the FX class, configured to work with the FileMaker application located at 127.0.0.1 and listening for requests for on port 591.

We can refer to the new instance of the FX class through the $query variable.

Line 3:[color:"white"]_____$query -> setDBData("Book_List.fp5", "Detail_View");

Configure our instance of the FX class to work with the Book_List.fp5 database.

Configure our instance of the FX class to only return values for the fields that are on the Detail_View layout.

Line 4:[color:"white"]_____$result = $query -> FMFindAll();

Create a new variable named $result.

Use our instance of the FX class to return all records from the database.

The records are returned as an object.

We can reference this object through the variable $result.

Line 5:[color:"white"]_____foreach ($result["data"] as $row) {

For each element in the "data" portion of the $result object,

process the code between the next set of curly brackets "{}".

Within the curly brackets, the current element can be referred to as "$row".

Line 6:[color:"white"]_____print ($row["title"][0]."<br>n");

Output some data to the browser.

Specifically, send the first row of data from the "Title" portion of the current "data" element for the $result object.

Follow this data by a <br> and a new line ("n").

The n is not visible in the browser as it is not HTML.

Line 7:[color:"white"]_____}

Signal the end of the loop.

Posted

Mariano,

I got PHP to work with IIS, now my problem lies with FX.php. I have configured all of the parameters in fx.php correctly ( I think) and when I load it on my browser it says there is an error in the CGI application, also with the program. Is there anything else you need to change in the parameters?

Thanks.

Justin Grewe

Posted

With any FX.php file I try to load on the browser, this is my response:

Could not open input file: C:Program.

All my regular php files are working as with a test file that outputs the stats on php with phpinfo().

I have attached what I have for the parameters in FX.php.

Thanks.

Justin Grewe

FXphp.txt

Posted

I wonder if you're running into a similar problem to what I had just a while ago. Now, I'm on a Mac, using Apache for PHP, so it's not going to be the same.

But with me, I'd put my files into the my user default web sharing folder, which worked fine for the plain jane PHP files. But the FX folder really needed to be in the real "Root" web serving folder, which was a special folder inside the system (not hidden or anything, but different from the user web folder).

Look at which folder phpinfo() is returning for its root web serving folder. Put the FX folder (I think just the FX.php and server_data.php files would do it) in there instead. Worth a try.

Posted

Well, its good to hear that you've got PHP working. Now let's get your FX demo scripts working as well. smile.gif By the way, please post your code which accesses FX.php, not the FX.php code itself. At this point, you should not have made any changes to the FX.php file. Remember, the FX.php file doesn't output anything to the browser - it is a file that you INCLUDE (using require_once() or include_once()) in your own code, which makes the FX class AVAILABLE to you as a programmer. FX.php doesn't do anything unless you instantiate it in your code. Look at the commentary on my example above for an explanation of what this means.

What happens if you create a script with the example code I wrote above? Just copy the code into a file named test.php, and put that file in the FX folder. Then call test.php from your browser. What happens?

The reason I provided the sample code above is because it is MUCH simpler and more universal than the code in the demo scripts that come with FX. The sample I provided above is much more likely to work without problems than the FX demo scripts because the demo scripts use commands which are specific to an older version of PHP, and which have been deprecated. Also, the FX demos use absolute addressing to locate the FX.php file, which varies from server to server and may not match the configuration on your web server (this is the problem Fenton encountered). We can correct that later on, but lets get a basic sample working first. wink.gif My sample code uses relative addressing, which will work as long as the test script is in the same folder as the FX.php file. If you want I would be happy to explain the value of absolute vs. relative addressing, and when to use one over the other.

Try running my sample code. The results will help us troubleshoot your problem much more effectively.

Posted

Mariano,

Now I am having trouble with php again. I have tried placing the test.php which is just a phpinfo() everywhere and telling IIS to make that the default location. It worked one time before but since then It says this:

CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

Could not open input file: C:Documents.

And if I put it in the Filemaker/Web/ folder it says the same thing but with:

CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

Could not open input file: C:Program.

What does it mean by the headers? I have not messed with the php.ini file in WINNT folder.

After I get this working again I can try to get that sample file that you gave to work.

Justin Grewe

Posted

It sounds like PHP was not installed properly. The easiest/best way to fix this is probably to start from scratch. Install IIS first, then install PHP. Read all the directions for installing PHP before installing it. A prelimary set of instructions are available in the PHP documentation, chapter 3:

http://us4.php.net/manual/en/installation.php

Also read the installation instructions bundled in the download. In your PHP4 folder, there should be a file named readme.txt, which has some valuable information.

The online documentation also has an entry in the FAQ which discuesses this exact error:

http://us4.php.net/manual/en/faq.installation.php#faq.installation.cgierror

A quick tip is to check if your PHP4PHP folder is in your path environment variable. You can check the environment variables by right clicking on "My Computer", clicking "Properties", clicking the "Advanced" tab, clicking the "Environment variables" button, then under "System variables" double click on the "Path" variable. Copy/Paste the ensuing "Variable Value" into a text editor where you can look at the contents more easily. Is the path to your PHP4PHP folder in there? If not, then add it by appending something like this to the environment variable: c:PHP4PHP. Make sure there is a semi-colon (: between your new variable and the rest of the string. (This along with all the other configurations are typically handled by the installer program).

Also, where is your web root (according to IIS)? c:inetpubwwwroot? c:program filesfilemakerfilemaker pro 6web? c:documents and settingsjustinmy documentsweb? Where ever it is, that folder must provide read/write permission to web users.

Also, check the ASP app mappings. Start > Settings > Control Panel > Administrative Tools > Internet Services Manager. Right click on "Default Web Site", click the "Home Directory" tab, click "Configuration", then in the "App Mappings" tab search for the .php entry. What is the Executable Path for .php? Make sure that whatever folder it is in (likely c:php4fastcgi) has file permissions that allow the web server to access it. At least for the time being, select the "Check that file exists" option. This will help us trouble shoot the problem, as it will return a descriptive error message generated directly by IIS (instead of PHP) if the script file doesn't exist. If the file doesn't exist, then the URL being supplied is incorrect, or the script file (test.php) is outside the web root.

  • 3 months later...
Posted

I have tried your example now, and yes I know that this thread is ooold :-) I am new to this, have only been using php and mySQL before. I put the test.php in the FX-folder, and I get the following error: could not open XML input

Do you have any clues on where I went wrong?

Posted

I can add a bit of info that might be helpful in figuring out my problem.

When i execute phpinfo; it says that the document_root is: /usr/local/apache/htdocs

But in reality it is: /local/www.ansatt.users/myusername/

I guess there is a possibility that this can have something to do with why I haven't been able to get anything useful out of any scripts. In the test.php which you pasted, I added a echo within the foreach-loop, but nothing appeared on the screen!

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