If you’re using Custom Web Publishing (CWP) with FileMaker Server v16 (PHP and XML) there are some changes in FileMaker Server v16 that you should be aware of that could break the functionality of your solution.
A client of ours recently upgraded their FileMaker Server to v16 which has a component that uses the FileMaker PHP API . One aspect of this involves a PHP page performing a FileMaker script which downloads files from an external service to the temp directory using the Get ( TemporaryPath ) function. Before I had a chance to troubleshoot this issue I noticed a post in the FileMaker Community titled “FMS 16 breaks CWP” – as a longtime PHP developer with many CWP client solutions this immediately caught my eye!
The post from David Jondreau mentioned that FileMaker Server v16 doesn’t support the Get ( TemporaryPath ) function – sure enough a quick check of the FileMaker v16 help confirms that under FileMaker v16 in “FileMaker WebDirect and Custom Web Publishing, this function is not supported and returns an empty string”. If you compare this to the FileMaker v15 help file it only states that in “In FileMaker WebDirect, this function is not supported and returns an empty string”.
I started troubleshooting my clients solution and after reviewing some server log table records that I had previously setup (always pays to have some kind of server side script logging setup that you can enable/disable on the fly as required) I could see that it was not generating a valid file path as the Get ( TemporaryPath ) function was returning an empty string. Our file paths to insert the image had gone from:
I was able to workaround this by splitting the single script into 2 scripts. The first script is called by the PHP page but it then utilises the Perform Script on Server (PSOS) script to run a script using FileMaker Server to download the file using the Get ( TemporaryPath ) function which is supported under FileMaker Server. The final sequence now looks like this:
- download.php file calls the newPerformScriptCommand to run a FileMaker script named ‘Start Image Download’ passing in a number of script parameters
- the ‘Start Image Download’ script runs under CWP and as part of this script it also includes a PSOS step to run another script named ‘Download Image’ in turn passing in a number of script parameters
- ‘Download Image’ runs as a PSOS successfully
I’ve since downloaded a copy of the FileMaker v16 help file and have been performing some searches to see if I can find any other changes for CWP compatibility. I couldn’t find any reference to these changes in the v16 Custom Web Publishing Guide or other release notes. David has started a new Product Idea in the FileMaker Community as well around this issue to see if some of the functionality can be restored. Hopefully someone from FileMaker Inc. can chime in with an update on why certain changes were made to CWP in v16 and provide a definitive list of what these changes were so we can put in place workarounds for solutions that will be deployed using FileMaker Server v16. If you know of any other CWP related changes in v16 please leave a comment below – I’ll update this post if I find out about any other changes as well.
Update 25 July, 2017: the FileMaker Community forum discussion has been updated with some feedback from FileMaker Inc. on why these changes were made: “Web clients (WebDirect, XML, & PHP) can no longer directly access files that are on the server (DBS) or worker (WPE) host file systems via scripting”. The solution is to use PSOS as described above.