Web Publishing with PHP and FileMaker 9- P6

Web Publishing with PHP and FileMaker 9- P6:On the other hand, it would drive me nuts if you bought this book only to discover that
it didn’t address your needs. In the spirit of customer satisfaction, please read the following
introduction to get a sense of where I’m coming from, and whether you might get
some good use out of this book.

Nội dung Text: Web Publishing with PHP and FileMaker 9- P6

Summary 65
File Options
The final step is to update the file options for the Product Catalog file. To access the file
options, select File, File Options. The File Options dialog box opens.
This dialog box allows you to specify the behavior for the file when it is opened or closed.
We want the file to ask for an account name and password whenever it is opened, so
uncheck the Log In Using check box (see Figure 4.17). When you are done, click the OK
button.
4
FIGURE 4.17 The completed File Options dialog box for the Product Catalog file should have
everything deactivated.
And with that, the file is ready to be hosted on FileMaker Server.
Summary
And so concludes our crash course in FileMaker development. We have reached the goal
of this chapter, which was to get a basic file working for use with the PHP scripts in
Chapters 6 and 7, “Viewing FileMaker Data” and “Altering FileMaker Data,” respectively.
We will continue to develop this file when we talk about working with related data and
portals in Chapter 8, “Working with Related Data (Portals)” and working with images and
container fields in Chapter 9, “Working with Images.”
For now, please have fun experimenting a bit with this file. Explore some of the other
menu options, do some data entry, perform some finds, and so on. FileMaker is famous
for its “legendary ease of use” and many people find that they can learn a lot by just
poking around the interface.

This page intentionally left blank

CHAPTER 5 IN THIS CHAPTER
. Introduction
Configuring the . Overview of Machine
Server(s) Configuration Options
. Installing and Configuring
FileMaker Server
. Testing Your Installation
. Hosting Your File
Introduction . PHP Site Assistant
In Chapter 1, “How Web Publishing Works,” I recom-
mended that you rent a web server when you are getting
started with web publishing. If you really want the behind-
the-scenes stuff to be taken care of by experts, you can take
things one step further and rent a web server that specifi-
cally supports FileMaker hosting.
These specialized types of hosting companies are referred to
as “FileMaker Hosting Providers.” Because they are not as
common as typical web hosting providers, they can be a bit
more expensive. However, using a FileMaker Hosting
Provider has a couple of big advantages:
. You don’t have to buy the FileMaker Server (FMS)
software.
. You don’t have to worry about administering the
server machine.
. Their uptime and performance will probably be better
than anything you could provide with your own
machine.
This is a great option for people who just want to create
files, upload them, and forget about it. However, if you are
more hands-on and want to get under the hood, you prob-
ably ought to pony up for FMS and maintain your own
machine (or machines, as we’ll see shortly).

68 CHAPTER 5 Configuring the Server(s)
NOTE
If you do rent a web server, be sure to talk to your provider about whether or not you
will be sharing disk space with its other customers. Depending on the sensitivity or
your data, you might want to consider paying for a dedicated server.
Overview of Machine Configuration Options
There are three main components to consider when working with FileMaker Server as a
website back end:
. Database Server—Hosts the FileMaker files.
. Web Server—Handles the browser requests.
. Web Publishing Engine (WPE)—Acts as the translator between the Web Server and
the Database Server.
These three components can be installed on one, two, or three machines, as follows:
. Single Machine—Database Server, Web Server, and WPE on a single machine
. Two Machines—Database Server on one machine and Web Server and WPE on
another machine
. Two Machines (Alternative)—Database Server and WPE on one machine and the
Web Server on another machine
. Three Machines—Database Server on one machine, WPE on a second machine, and
Web Server on a third machine
There are a number of considerations when deciding on a machine configuration:
. Single Machine allows for very fast communication between the three components,
but puts a heavy load on the processor. Also, it means that you have a single point
of failure. With a multiple machine configuration, you can reboot your web server
without affecting clients connecting to the database with FMP.
. Two Machines spreads out the processor load and separates the website load from
the FileMaker Pro client connections. If you have a lot of FileMaker Pro client activ-
ity, and a lot of web activity, this might be a good option. However, the communi-
cation between the WPE and FMS could be a bottleneck if the connection speed is
lacking.
. Two Machines (Alternative) moves the WPE to the FMS machine, which means that
web requests to the database could impact your FMP clients more so than the
regular Two Machines configuration.

Installing and Configuring FileMaker Server 69
. Three Machines spreads out the processor load the most, but a slow connection
between any of the machines can cause performance problems. Also, there is the
obvious expense of the three machines.
Only you can decide which machine configuration is best for you, but here are some
thoughts that might help:
. If you are not sure which option is best for you, go with the easiest and least expen-
sive. You can always ramp up if you find that performance or stability is lacking.
. For development purposes, I am a big fan of the Single Machine configuration. I just
install everything on my laptop and I am good to go, even without a network
connection.
Installing and Configuring FileMaker Server
This installation process is pretty straightforward—you just insert the disk, launch the
installer, and follow the instructions. However, there are a couple of options depending
on which machine configuration you are planning to use.
5
NOTE
If you have a previous version of FMS installed, there are a few things that you should
do prior to installation:
1. Uninstall any previous version of FMS.
2. On your web server machine, revert your httpd.conf file to its default state.
3. Restart your machine (or machines).
After you read and agree to the software license agreement, you will be asked to decide
between a single or multiple machine configuration (see Figure 5.1).
If you select Single Machine and click Next, you will then be asked to enter your name,
organization, and your license key. Then, you click the Install button and sit back. The
installation can take a few minutes—there are more than 6,000 files that need to be
created on your hard drive.
If you opt for a Multiple Machines install, you will be presented with an additional screen
asking whether this particular installation is the Master machine, or a Worker machine
(see Figure 5.2). The master machine is the one on which your FileMaker files will be
hosted, and might or might not be running the WPE. The worker machine is the one
running the WPE, the web server, or both.
NOTE
If you are planning a multiple machine installation, I recommend doing the installs on
the worker machine or machines first, and the master machine (the Database Server)
last.

70 CHAPTER 5 Configuring the Server(s)
FIGURE 5.1 The FileMaker Server installer prompts you to specify the number of machines
for the installation.
FIGURE 5.2 For a multiple machine installation, you are asked to specify whether this is the
master machine or a worker machine. The master machine is the one that will actually host the
database files.
If you select Master and click Next, you are prompted to enter your name, organization,
and your license key. If you select Worker and click Next, the installer does not prompt
you for any information and just proceeds with the installation.
After the FMS install is complete (either the Single Machine or Master Machine), the
installer asks you whether you want to deploy FileMaker Server. You can opt to continue,
which will launch the Deployment Assistant, or you can quit to leave the installer.

Installing and Configuring FileMaker Server 71
Click Continue to launch the Deployment Assistant. The server prelaunch page opens in
a browser (see Figure 5.3). After a minute or so, the page updates and tells you that the
Admin Console is starting. Be patient while this process completes. It can take several
minutes.
5
FIGURE 5.3 The Admin Console Start Page appears automatically after the installation of
the Database Server.
A file named admin_console_init_webstart.jnlp will be downloaded to your default
download directory. It is a Java Web Start application that kicks off the initial launch of
the Admin Console and the Deployment Assistant. In another minute or so, you will be
presented with the first page of the five-page Deployment Assistant (see Figure 5.4) and
walked through the following steps.
NOTE
Some browser configurations can prevent the jnlp file from launching automatically
after download. If nothing seems to happen, you can just manually launch the jnlp file
by double-clicking it.
. Page 1—Specify a username and password that will be used to open the Admin
Console.
. Page 2—Specify a name and other optional information about this FMS installation.
The server name that you choose is what will appear in the Open Remote dialog
box for FileMaker Pro users.
. Page 3—Specify whether you want to allow clients to connect to your FileMaker
database via ODBC. This is only available with FileMaker Server Advanced.
. Page 4—Specify whether you want to enable web publishing. You should select Yes
on this page.

72 CHAPTER 5 Configuring the Server(s)
. Page 4, part 2—Specify which web technologies you want to enable. For now, you
just need to enable PHP. Under the PHP option, you need to choose whether to use
FileMaker Server’s version or not. You will probably want to use FileMaker’s version,
unless you have your own customized version of PHP installed. (Note that Instant
Web Publishing is only available with FileMaker Server Advanced.)
. Page 4, part 3—Select a web server. In most cases, there will only be one web server
option. If there is more than one, specify your selection.
. Page 5—A summary of your deployment. Click Finish to close the Deployment
Assistant. You will be asked to stand by while the deployment is executed.
FIGURE 5.4 This is the first page of the Deployment Assistant that launches after your initial
install of the Database Server.
When the deployment process completes, you will see the FileMaker Server Admin
Console Welcome dialog box (see Figure 5.5). Click the OK button to dismiss the
dialog box.
You will be presented with the Overview page of the FileMaker Server Admin Console (see
Figure 5.6). The overview page gives you a quick view into the status of the server. There
should be three green circles in the center area—one each next to the Web Server, the
Web Publishing Engine, and the Database Server.
NOTE
Note that in the lower-right area of the screen is a link to the Deployment Assistant,
where you can modify your deployment options should you change your mind in the
future.

Installing and Configuring FileMaker Server 73
FIGURE 5.5 The Admin Console Welcome dialog box allows you to register your server or
open the technology tests page. You can easily access these options from the Admin Console
later, if you want.
5
FIGURE 5.6 The Admin Console Overview page gives you a quick view into the status of
the server.
NOTE
If you are familiar with previous versions of FMS, you are in for a number of big—and
pleasant—surprises with FMS 9, particularly with regard to the new Admin Console:
. All aspects of FMS can be administered from a single interface (the Server
Admin Tool and the Web Publishing Admin Console have been combined).

74 CHAPTER 5 Configuring the Server(s)
. The interface is identical on both Mac and Windows.
. The server can be administered from any machine with a network connection—
no prior installations necessary.
. You can upload FileMaker files to the server through the Admin Console.
. FileMaker scripts can be scheduled to run in the background.
. Backup schedules are automatically created by default.
. Backup files are scanned to ensure that they are not corrupt.
. You can set up email notifications for server warnings and errors.
There are an enormous number of configuration options in the Admin Console, but, in
most cases, the default configuration should serve you just fine. Still, there are a few
things you should be familiar with if you are administering the FMS machine.
Administration: Clients
This page allows you to disconnect or send a message to an individual client or all clients
of the server. The tabs at the lower portion of the page alternately provide information
about which databases the selected client has open, or details about the selected client
(see Figure 5.7).
FIGURE 5.7 The Administration: Clients page of the Admin Console allows you to see who
is connected to what. You can then send messages to, or disconnect one or all clients, from
this page.

Installing and Configuring FileMaker Server 75
Administration: Databases
This page displays a list of databases hosted on your server. Using the Actions menu, you
can opt to Open, Close, Pause, Resume, Upload, or Remove one or all databases. You can
also send a message to the FileMaker Pro clients of one or all databases (see Figure 5.8).
5
FIGURE 5.8 The Administration: Databases page of the Admin Console displays which data-
bases are on the server, their status, what types of connections are allowed, and which clients
are connected to each file, if any.
NOTE
In previous versions of FileMaker Server, it was possible to manually copy a file to the
server that did not have the fmapp extended privilege enabled, meaning that you could
effectively host a file that you couldn’t access with FileMaker Pro. When using the
Upload feature of FMS 9, the file is now checked for this issue. If the fmapp extended
privilege is missing from all privilege sets, it is automatically assigned to the Full
Access privilege set. An additional improvement over previous versions of FMS is that
the file system permissions on the uploaded file are now set appropriately. Previously,
this was a manual operation on the Mac platform.
Administration: Schedules
This page allows you to specify automated tasks. There are three types of scheduled
actions supported:

76 CHAPTER 5 Configuring the Server(s)
. Back Up Databases
. Run a Script (executes a shell script, batch file, or FileMaker script)
. Send a Message (sends a message to connected FMP users)
By default, three backup schedules are created when you install FMS—Daily, Hourly, and
Weekly—but only Daily is enabled (see Figure 5.9).
FIGURE 5.9 The Administration: Schedules page of the Admin Console shows you what auto-
mated tasks have been scheduled, what type they are, whether they are enabled, and when
they are going to run next, among other things.
NOTE
The ability to run a FileMaker script is a new—and welcome—feature. It allows you to
select a script from one of the host files to run at a specified time. Writing FileMaker
scripts is not a topic covered in this book, but if you are already familiar with the
concept, this is a great feature. (Note that only web-compatible script steps are
supported.)

Hosting Your File 77
Testing Your Installation
After you are satisfied with your installation and configuration, you can test FileMaker
Server as follows:
1. Select the Open Test Page option from the Server menu of the Admin Console. A
browser window should open to the FileMaker Server Technology Test page. There
are up to four active links on the test page, depending on whether you have
FileMaker Server or FileMaker Server Advanced installed. In this case, we want to
test FileMaker Pro and PHP Custom Web Publishing.
2. If you have multiple versions of FileMaker Pro installed, make sure only FMP 9 is
running.
3. Click the Test FileMaker Pro link. The FMServer_Sample.fp7 file should open in
FMP 9.
4. Click the Test PHP Custom Web Publishing link. A new browser window should
open displaying a list of records from the FMServer_Sample.fp7 database. There will
also be a green circle on the page indicating that the test was successful. If the test
failed, the circle would be red.
5
If either of the tests fail, navigate to the Administration: Databases screen and confirm
that the FMServer_Sample.fp7 is open. If it is open, stop and restart the database server. If
your test still fails, restart the machine and try again. If that still doesn’t work, call me at
home and I’ll fix it. Uh…just kidding.
Hosting Your File
Now we are ready to upload the Product Catalog.fp7 file to the Database Server.
1. Navigate to the Administration: Databases screen in the Admin Console.
2. Select Upload from the Actions menu and click the Perform Action button.
3. Follow the instructions in the Upload Database Assistant to select the Product
Catalog.fp7 file and upload it to the server (see Figures 5.10 through 5.14).
After this process is completed, you should see the Product Catalog.fp7 file in the list of
databases.

78 CHAPTER 5 Configuring the Server(s)
FIGURE 5.10 After launching the Upload Assistant, click the Add Database button.
FIGURE 5.11 You will be asked to select a database to upload.

Hosting Your File 79
FIGURE 5.12 After the database is selected, it will appear in the list. Click the Next button
5
to upload the file.
FIGURE 5.13 You can opt to open the file after upload, or not. Note that the fmapp
extended privilege will be added to the Full Access privilege set if it is not enabled for any
privilege sets.