How to Upgrade PHP on a FileMaker Server Running on MacOS

What’s happening and why is it important?

The default version of PHP that ships with FileMaker Server 17.0.4 up to 18.0.2 is 7.1.*. This particular version is no longer receiving active support and won’t receive any security updates starting on Dec 1st, 2019. Any version before FileMaker server 17.0.4 uses a version of PHP that is no longer supported. Running web apps on an unsupported version of PHP is not recommended, and will compromise the security of your application.

PHP’s Support Timeline

Which version do I have?

You can check which version of PHP you’re running by doing the following:

  • Open your code editor
  • Add the following: <?php phpinfo(); ?>
  • Save the file as info.php in
    • If SSL/TLS encryption is turned on: /Library/FileMaker Server/HTTPServer/htdocs/httpsRoot
    • Otherwise: Library/FileMaker Server/HTTPServer/htdocs/
  • Open it in your web browser by entering the following link: [Your FM Server domain or IP]/info.php (example: fms.example.com/info.php)
    Or use localhost/info.php if you open the browser on your server.
  • Check the version displayed at the top of the page.
Sample PHP info page.

Before you upgrade:

Before you upgrade, make sure you test your app on a test server running the latest version of PHP. Don’t upgrade an app in production if you haven’t tested it first with the new PHP version.

How to upgrade PHP on a FileMaker Server running on MacOS:

We’ll be using homebrew to install the latest version of PHP. Homebrew (https://brew.sh) is an open-source package manager for OSX. The following steps were tested on MacOS Mojave.

  • Install homebrew:
    • Open the terminal
    • Paste the following code /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" (or copy the command from homebrew’s home page)
    • Wait until the installation is completed
  • Install PHP:
    • In terminal, execute: brew install php
    • Enter your OS admin password when prompted
  • You should get an output similar to this once done:
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /usr/local/etc/php/7.3/

To have launchd start php now and restart at login:
  brew services start php
Or, if you don't want/need a background service you can just run:
  php-fpm
  • Copy the line that starts with LoadModule php7_module from that output
  • Stop Apache by running the following command in terminal sudo /Library/FileMaker\ Server/HTTPServer/bin/httpdctl stop
    • WARNING: Stopping Apache might prevent container fields form previewing PDF files as long as it’s stopped. Make sure you warn users about it.
  • Open /Library/FileMaker Server/Web Publishing/publishing-engine/php/mojave/httpd.fmi.conf.php
  • Add a # at the beginning of the line that starts with LoadModule php7_module to comment out FileMaker’s old PHP path and add the line you copied previously under it. This will direct FileMaker Server’s web server (Apache) to the new PHP installation. Example:
#LoadModule php7_module        "/Library/FileMaker Server/Web Publishing/publishing-engine/php/mojave/libphp7.so"
LoadModule php7_module        "/usr/local/opt/php/lib/httpd/modules/libphp7.so"
  • Start Apache: sudo /Library/FileMaker\ Server/HTTPServer/bin/httpdctl start
  • Check the info page again and make sure that you’re running the newer version of PHP.

What if my FileMaker API is not compatible with the new PHP version?

Going further

  • While testing your web app on a test server, review your PHP.ini file (/Library/FileMaker Server/Web Publishing/publishing-engine/php/mojave/lib/php.ini). Compare it with OWASP’s recommendations here. You can read about each php.ini value here.
  • We are happy to upgrade for you if you don’t want to do it yourself. Schedule a window for this upgrade by emailing sales@app.works.