Hosting PHP websites
Custom Web Publishing with PHP lets you use the PHP scripting language to integrate data from FileMaker Pro databases with your customized webpage layouts. In your webpages, you call the FileMaker API for PHP, which is a PHP class created by FileMaker that accesses databases hosted by FileMaker Server. This PHP class connects to the Web Publishing Engine and makes data available to the web server’s PHP engine.
For information on developing a PHP website and preparing a database, see FileMaker Server Custom Web Publishing Guide.
Note For Linux, Custom Web Publishing with PHP and XML is not supported.
To host a website that uses Custom Web Publishing with PHP:
- In FileMaker Pro, open the database and edit the privilege set for the account that will access the database. Enable the extended privilege Access via PHP Web Publishing - FMS only.
Note If your FileMaker Pro database solution uses more than one FileMaker Pro database file, all of the database files accessed using PHP must use this privilege set with the extended privilege Access via PHP Web Publishing - FMS only enabled.
- Using the CLI, enable Custom Web Publishing with PHP using the following command:
fmsadmin set cwpconfig enablephp=true
If necessary, set additional options for Custom Web Publishing with PHP, such as locale or encoding.
- In Admin Console, make sure the Web Publishing Engine is enabled on the master machine. See Web publishing settings.
- Verify that Custom Web Publishing with PHP is working in your FileMaker Server deployment. If you don’t have a sample to use for testing, you can use the following PHP sample that retrieves data from a sample database. Enter the following URL into a web browser on the machine where FileMaker Server is installed:
If you see a success message and sample data from the FMServer_Sample database, then PHP is working in your FileMaker Server deployment.
- Prepare databases for Custom Web Publishing. See FileMaker Server Custom Web Publishing Guide.
- Upload the database file to FileMaker Server. See Hosting databases
Note If your FileMaker Pro database solution uses more than one FileMaker Pro database file, all of the database files must be on the same computer.
- Copy your PHP files to the web server’s root folder. In a multiple-machine deployment, this folder is on the master machine. The following shows the default locations:
- For IIS (Windows) through HTTP or HTTPS:
[drive]:\Program Files\FileMaker\FileMaker Server\HTTPServer\Conf
where [drive] is the drive on which your FileMaker Server deployment resides.
- For Apache (macOS) through HTTP:
- For Apache (macOS) through HTTPS:
On macOS, make sure the folder ownership and permissions allow members of the fmsadmin group to edit the PHP files. See Users, groups, and permissions (macOS).
- For IIS (Windows) through HTTP or HTTPS:
- If you have not already done so, copy or move any referenced container objects to the appropriate directory on the master machine.
If a database container field stores a file reference instead of an actual file, then the referenced container object will be stored in the FileMaker Pro Web folder when the record is created or edited. To host your site on FileMaker Server, you must then copy or move the referenced containers to a folder with the same relative location in the root folder of the web server software.
See FileMaker Server Custom Web Publishing Guide for information about using container fields with PHP solutions.
- To access your PHP website, use the following URL syntax:
<scheme>is the HTTP or HTTPS protocol.
<host>is the IP address or domain name of the FileMaker Server computer. For a multiple-machine deployment, you can use the IP address or the domain name of the master machine or a worker machine; the web server will forward the URL to the master machine. (Use the IP address or domain name for the Web Publishing Engine on the Connectors > Web Publishing tab.)
<port>is optional and specifies the port that the web server is listening on. If no port is specified, then the default port for the protocol is assumed. For HTTP, the port is port 80; for HTTPS, the port is port 443.
<path>is optional and specifies the folder inside the web server root folder where the PHP file is located.
<filename>is the filename of a page in your website.