FileMaker Web Publishing FileMaker allows 3 different types of web publishing. Instant Web Publishing (IWP), Custom Web Publishing (CWP) and Static Web Publishing (SWP). In this brief informational guide, we will discuss Custom Web Publishing. What is FileMaker Custom Web Publishing? FileMaker Custom Web Publishing enables you to build dynamic websites and use FileMaker as the website engine, also known as the backend. Many companies are not even aware that they can bring their database solution to the web. Many companies still operate the old fashioned way. Here is an example: Let’s say that you own a shoe warehouse and you stock thousands of shoes. Currently you fax a weekly update list of all of your shoes to your clients.

The Smart Way, The PHP Way Using FileMaker you could create a database that keeps a real time inventory of your shoes and the shipping of your shoes. You could then create a website that enables your clients to login and check your inventory at any time. They could search your inventory database and even place orders for shoes based on live, real-time information. Once they have ordered the shoes, since it is real time, the quantity ordered shows as deleted from the database. No more phone calls, no more faxes. You clients can check your inventory from anywhere in the world 24/7. FileMaker makes this a powerful quick solution to implement both internally and on the web.

Why do companies use FileMaker Pro instead of SQL? There are several reasons why companies choose FileMaker over SQL databases such as MySQL or Oracle. One of the main reasons is the individual or the company is already using FileMaker at their home or office as a database application. Many companies have spent a lot of time and money implementing a FileMaker solution and they are very comfortable with FileMaker. Therefore, the next logical step is to use FileMaker to bring the data to the web. FileMaker is also known for its rapid development abilities and an intuitive user interface…none of which are strong characteristics of SQL based engines. FileMaker includes a lot of logic and business rules that aren’t currently implemented in MySQL. Just think, when you use FileMaker, all of your graphical layouts, scripting and database functions are combined into one easy to use package. FileMaker is easy to learn and easily adapts to most situations. FileMaker also enables companies to build robust powerful solutions and has the ability to quickly generate complex reports, as well as Import/Export routines. It is quite simple to create and extend your solution to the web. What do FileMaker and FMWebschool suggest? We suggest that you begin working with the new API for PHP (Advanced Programming Interface) immediately. FileMaker is taking a strong stance for supporting PHP and seems to be moving towards incorporating the new API for PHP into future product releases. This is great news! A quick look at this years FileMaker Developer Conference (Devcon) this year demonstrates FileMaker’s support for PHP. This year there are more PHP sessions than any other scheduled topics.

FMWebschool quickly realized the power of PHP and FileMaker, and immediately began providing resources and migration tools for the FileMaker community. FMWebschool of course recommends using this API with PHP as the quickest and easiest way to bring your FileMaker solution to the web. FMWebschool is currently beta testing their new CDML conversion tool. This tool enables CDML users the ability to quickly translate their files to the new FileMaker API. What is the new FileMaker API for PHP? The FileMaker API for PHP is the new quick way of putting FileMaker data on the Web using the web publishing XML component from FileMaker Server Advanced. The new PHP API makes it easy to retrieve and manipulate data from your FileMaker database using standard PHP functions. Simply put, the new API allows a PHP programmer of any skill level to start sending and receiving data from your database within minutes. • • • The FileMaker API for API is a server side PHP class that enables you to bring FileMaker to the web. The PHP API class is written by FileMaker Inc specifically for their server. When you download the FileMaker API for PHP, you are downloading all of the files needed to interact with FileMaker.

The new FileMaker API for PHP enables you to: • • • • • Create records, Delete Records, Edit Records and Duplicate Records Run FileMaker Scripts Display Portals, Value List, Access Layouts and Related Fields Perform Find Request Perform Field and Record Validation

Where do I get the PHP API? You can download the PHP API from You will notice that there are two downloads available on the FileMaker website. • • • If you already have PHP configured and running on your machine, you can download the “Component Bundle Version”. This includes the FileMaker API for PHP, Example code and files, and the API documentation. If you do not have PHP installed, then you will need to download the “Full Installer Version”. The full installer version installs PHP 5.1.2 engine, the FileMaker API for PHP, Example code and files, and the API documentation. The FileMaker API for PHP has been tested on PHP versions 4.3.11, PHP 4.4.1, and PHP 5.1.2.

OK, I’ve downloaded it, now what? What happens next depends on your answers to a couple questions. Will you be hosting your website or will you be using a hosting company? There are several questions you need to ask yourself. • • • • • • • Do you have the equipment necessary to host a custom website? Do you have a dedicated IP address and high speed Internet? Do you want the responsibility of making sure your web server is operational 24 hours a day? How much traffic will you be receiving? Can I host my web files and database files separately? Is it ok to host my website and local network on the same server? Do I want to have a local server to use for testing even when I am offline?

Hosting Myself If you are going to host the website yourself, you will first need to make sure that your host machine (server) is properly configured with the proper software and that you have PHP installed. First we need to find out if you will be using a Macintosh or Windows web server. If you are using a Macintosh you will need to make sure the following is installed and configured. You will also need to have OS X10.4 Installed. High Speed Internet with a dedicated IP address for production environments Apache Server is installed by default on Mac OS X PHP is already installed but needs to be configured. (You will however have to have cURL support) To make sure that you have cURL support you can download an updated version of PHP for Mac at: • FileMaker Server 8.04 Advanced must be installed on your computer. You can update your FileMaker Server Advanced to 8.04 here: • You must download the FileMaker API for PHP and copy the FileMaker folder to the directory listed below. The root directory is “HD:/Library/Web Server/Documents. How to configure PHP on Mac OS X PHP is installed but not turned on by default on Mac OS X (any flavor). You have to modify a hidden file called httpd.conf. Follow these steps carefully otherwise you can really mess things up. You can use a web editor like BBEdit or TextEdit. I' using BBEdit for these instructions. m TextEdit is a little bit more involved than BBEdit since it won'unlock a file that is owned by root. If t you don'have BBEdit, you can always download a demo version of it that will allow you to do t this. 1. In Finder, go to the Go menu and select Go to Folder 2. Type: /etc/httpd/ and then hit the Go button. 3. In the window that opens, open the file titled: httpd.conf • • •

4. Using the Find command, search for: #LoadModule php4_module 5. Delete the # (If you are using BBEdit, it will tell you that the document is own by root and do you want to unlock it. The answer is yes.) 6. Next scroll down about 40 lines and you' find a line that is: #AddModule mod_php4.c ll 7. Again delete the # 8. Click on the close button on the file. It will ask you for your admin password first and then it will save your changes. Also don'forget that you need to start Personal Web Sharing located in the Sharing panel of t System Preferences too.

If you are using a Windows machine you will need to make sure the following is installed and configured. High speed Internet with a dedicated IP address for production environments IIS must be installed and configured on your computer. This means you must either be running XP Pro, or Server 2003+ • PHP must be downloaded and installed on your machine. You can download a Windows installer using our link, which always provides the newest copy: (Be sure to follow the directions to make sure PHP is installed correctly.) A quick and easy way to make sure PHP is configured correctly is to create a text document and name it phpinfo.php. Add the following to the page: <?php phpinfo(); ?> Save the page in your web server. In Windows the root directory is C:\Inetpub\wwwroot. Open your browser and type your local address and the name of the page you created. Ex. This should bring up the page that gives all of the PHP configuration information. The page should look something like the one below. • •

FileMaker Server 8.04 Advanced must be installed on your computer; a help guide for configuring IIS can be downloaded here.

• •

You must download the FileMaker API for PHP and copy the FileMaker folder to the directory listed below. Using IIS on Windows, the root directory is C:\Inetpub\wwwroot. If you only have 1 website, you can place your web pages and FileMaker folder here.

Once you have all of the above steps finished you are ready to start working with the FileMaker API for PHP! So, here’s a quick re-cap: Where do I put the FileMaker API for PHP on my computer? Windows Using IIS on Windows, the root directory is C:\Inetpub\wwwroot. If you only have 1 website, you can place your web pages and FileMaker folder here. If you will have more than one website, place your website folder here and the FileMaker folder within your website folder. Macintosh You will be using the Apache web server on Macintosh. The root directory is “HD:/Library/Web Server/Documents. If you will have more than one website, place your website folder here and the FileMaker folder within your website folder. I want to use a FileMaker Hosting Company • • • Can I host my web files and database files separately? How do I access my database files if they are being hosted? Can I still import and export records if a hosting company is hosting my database files?

Wonderful choice! Using a professional FileMaker web hosting company is a very smart way to go! These experts will be able to answer all of your hosting questions and help you to get the best results. Also, the hosting company has assumed the cost of the server and server software. Your only financial requirement is a monthly payment for their services. Can I host my web files and database files separately? If you currently have your website hosted at a Non-FileMaker hosting company, you can certainly leave your website at your current host and have your database files hosted at the FileMaker Hosting company. Actually, this is extremely commonplace. How do I access my database files if they are being hosted? Many individuals fear that if they have a FileMaker hosting company host their files that they will no longer be able to access their database files from their own computer and make basic changes. This certainly is not the case. As long as you have a client version of FileMaker running on your desktop you can access your database through “Open Remote”. “Open Remote” will open the FileMaker file on your local computer. You can make changes to layouts; add scripts, import, export and more. Watch this online movie to get an understanding of how this all works.

How do I write or edit the PHP files for the API? PHP can be written easily with any text editor, or web editor. Like HTML, PHP is simply just text on a page. You can create a web page with a text editor, and save it with a “.php” extension. So a page would look like “mypage.php”. There are many web editors on the market that you can use to write PHP code. FMWebschool uses Macromedia DreamWeaver to build and edit PHP pages. You can download a 30-day demo at

How can I test my FileMaker API for PHP pages? Testing your web pages as you build them is extremely important. However to test your pages you will need to have FileMaker Server Advanced 8.04. If you are an FSA member, you can get a free Developer License for FileMaker Server Advanced. The Developer license allows you to test your pages live and will allow 3 simultaneous connections. Another easy way to get the developers license is by joining the FSA (FileMaker Solutions Alliance). You can join the FSA for as little as $199.00. Once you join, you will receive a full version of FileMaker, and the Developer License of Server Advanced. You will also be able to participate in the FSA talk list that connects developers together, allowing the exchange of ideas and technical support with fellow FileMaker enthusiast. Third, you can build your pages and host them at a FileMaker hosting company. You can test them there to see if they are working. Also, before you begin using FileMaker with the new API, you will need to define an extended privilege set named fmphp. This needs to be done in “every” database that you want to access with the FileMaker API. How do I define an extended privilege set? To do this, simply select File > Define > Accounts & Privileges Select the Extended Privileges tab and click the “New” button.

Type fmphp into the Keyword field and select the level of access you wish to grant below. Then click on the “OK” button.

You will see fmphp appear in the list of Extended Privileges

Click OK, and you are finished.

Remember to use custom web publishing with the FileMaker API for PHP you have to have FileMaker Server Advanced 8.04, or use a FileMaker Hosting Company. FMWebschool will be presenting another option soon that will enable you to test your PHP pages without Server Advanced. Another important note is that the FileMaker API for PHP uses UTF-8 encoding. However most HTML pages use the ISO-Latin-1 character set (ISO-8859-1). In order to display non-ASCII characters correctly, you will need to add this line of code to the <head> section in your PHP page: <meta http-equiv=”content-type” content=”text/html; charset=UTF-8”> How hard is it to develop with PHP? Compared to other web languages, PHP is considered one of the easiest languages to master! Currently there are over 25 million PHP web sites. PHP is known for its simple syntax, and its open source code base. There are other proprietary languages like Lasso, but the problem here is that there are very few Lasso developers and Lasso is not recognized by the majority of web developers and web hosts. There are literally thousands of skilled PHP developers and hundreds of online PHP forums. PHP is considered the “standard” in scripting languages for web publishing. FileMaker API for PHP is a class of PHP. The language is the same and the terminology is the same as regular PHP. PHP is the most widely used scripting language on the Internet, and if you develop pages with the FileMaker API for PHP any competent PHP developer will immediately recognize the code and after a short amount of time be able to apply the code to your projects. Hiring a PHP developer can save you both time and money compared to hiring a niche FileMaker specialist.

Here is a great example. FMWebschool recently hired a new programmer. He had never used FileMaker, but was very skilled with PHP. We spent two days working with him, teaching him the basics of FileMaker Pro. At that time, we also gave him our new FileMaker Web Publishing book. Within two days, Michael was building FileMaker websites for us. Within a week, he had finished 3 small projects for us. PHP is a great language to learn! Not only can you use PHP with FileMaker, you can use PHP with MySQL, Oracle and Access. PHP also supports ODBC, which allows virtually all database systems to interact with it using a common code layer. Resources FMWebschool has created several resources for the new FileMaker PHP API. These new websites and books will help you quickly bring your FileMaker solution to the web. We have created a blog for the new FileMaker API for PHP We have created a new section on our forum exclusively for the new FileMaker API for PHP And we are releasing a new book and video series on the new FileMaker API for PHP the book and video series will be available August 2nd Q&A Is the FileMaker API for PHP like regular PHP? The short answer is yes. The API uses the same coding, and the same terminology as PHP. PHP has many libraries and classes. The FileMaker API is merely one of the “classes” that PHP uses. Any PHP developer will immediately recognize the FileMaker API code as PHP. What are some of the things I can do with the API? This question could fill an entire book. PHP is an incredibly powerful scripting language. So, I am going to stick with “What are some of the things I can do with the PHP API and FileMaker”? • • • • • • • • • Create Dynamic websites that enable your users to create and edit records Create websites that enable you to display information from FileMaker dynamically and convert this information into powerful charts, formatted spreadsheets, and even PDF’s. Display FileMaker Value Lists, Portals and Images. You can even offer the ability for individuals to upload images to your website with PHP. PHP enables you to connect to FileMaker either via the web, or by using ODBC. PHP enables you to run scripts from FileMaker PHP enables you to send emails PHP enables you to upload files Whether you are trying to build a sleek contact management system, a shopping cart system, an online forum, or an online survey, PHP is the way to go! PHP allows you to connect multiple sources of data into your website, you are not restricted to FileMaker data anymore and can now link with RSS feeds, Podcasts, and other databases.

Where can I get more resources? PHP Website (Download the most recent version of PHP) Great PHP website for Macintosh installers FMWebschool Website (Books, Tutorials, Open Source Example Files) FMWebschool Forum (Friendly forum for individuals interested in all aspects of FileMaker web publishing) FileMaker Inc. The homepage of PHP API at FileMaker Inc. FileMaker Hosting Companies (Great hosting companies for FileMaker web publishing) John May Dan Weiss What has happened to FX.php class written by Chris Hansen? Nothing has happened to Chris Hansen’s class, FX.php still remains as a viable solution for bringing FileMaker to the web. If you or your customer’s are currently using FX.php there is no reason to panic, FX.php will not be going anywhere. Chris plans on releasing an update soon. Can FX.php and the new FileMaker PHP API exist on the same server? Yes, they certainly can. You can even have them functioning together on the same page. That is one of the wonderful things about PHP. Can the new FileMaker API for PHP do things that FX.php cannot do? The new API allows you to return portal records with a single command. The ability to trap for errors is much more robust. The differences between the two APIs are at this time restricted to their design. FileMaker API for PHP is a much more object oriented API which was professionally designed, making it much more friendly when it comes to trapping errors. Initially it takes some time to get used to the idea of creating objects for different calls, but in the end it can make the code much more organized. Another benefit of switching to the new API is the certainty of its future support by FileMaker Inc since PHP is a very big player in the server side scripting market. Otherwise at this time we do not see many great new features in the FileMaker API for PHP, with the exception of better data

validation – which we suggest using pure PHP for either way, since it allows very complex validation routines. We suggest using the new PHPAPI to learn better object oriented practices and write PHP classes around that structure – making your classes reusable from one project to the next. Please let us know if this documentation is helpful. If you have ideas for additions or changes, please email me and let me know. In Kindness Stephen Knight 800.353.7950

This article was written by Stephen Knight. You may use this article on your website, or email copies to friends as long as the article remains in its completed form. This article is copyright © 2006 FMWebschool, Inc. FileMaker and the FileMaker logo are registered trademarks of FileMaker, Inc All other trademarks and copyrights are the property of their respective owners. FX.php is copyright 2001-2006 Chris Hansen