November 27, 2019 Blog FileMaker FileMaker Techniques FileMaker ServerFileMaker Server Running on MacOSOutdated PHP on FileMaker ServerUpgrade PHP 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 editorAdd the following: <?php phpinfo(); ?>Save the file as info.php in If SSL/TLS encryption is turned on: /Library/FileMaker Server/HTTPServer/htdocs/httpsRootOtherwise: 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 terminalPaste 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 completedInstall PHP: In terminal, execute: brew install phpEnter your OS admin password when promptedYou 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 outputStop Apache by running the following command in terminal sudo /Library/FileMaker\ Server/HTTPServer/bin/httpdctl stopWARNING: 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.phpAdd 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 startCheck 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? You can replace your PHP API with one of these (Special thanks to their authors):https://github.com/airmoi/FileMakerhttps://github.com/matatirosolutions/filemakerapihttps://github.com/driftwoodinteractive/fmPDA 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. By Karl Jreijiri
2 Comments Manuel Prado Posted on 3:31 PM - January 9, 2020 Thanks a lot for publishing this, I just created a full API to overcome some FM shortcomings using laravel 6 and it requires at least PHP version 7.2. I have saved this page for future reference, I have the feeling this will not be the last time I have to upgrade the PHP server version manually. Ninad Dixit Posted on 4:42 AM - June 19, 2020 Good blog, Karl. The blog gives good information about how to upgrade PHP on a FileMaker server. The blog is written well and is informative. How to check your version of PHP is also explained nicely. It is important to upgrade to the latest version of PHP for security reasons.