Back to Browse

Run PHP 8.0, 7.4 and 5.6 simultaneously in a macOS development environment

3.4K views
Feb 10, 2021
47:57

This video follows the steps documented at https://xenforo.com/docs/dev/macos-dev Sometimes, it's necessary to test your code in multiple versions of PHP, or perhaps your applications have particular PHP version requirements. While it's possible to install multiple versions of PHP, the normal way of doing things is to use just one of the installed versions at a time. But it doesn't have to be like that. This tutorial for macOS will take you through the steps necessary to get multiple versions of PHP up and running simultaneously, so that you can pick your PHP version with a simple .htaccess file in the containing directory for your code. Along the way, you'll also install and configure everything else you need to run and develop for XenForo and debug your code with Xdebug. The process is documented in the XenForo 2 Developer Docs, here: https://xenforo.com/xf2-docs/dev/macos-dev/ This tutorial makes use of Homebrew, Visual Studio Code and TablePlus: XenForo: https://xenforo.com Homebrew: https://brew.sh Visual Studio Code: https://code.visualstudio.com/ TablePlus: https://www.tableplus.io Xdebug: https://xdebug.org Mentions of the prior, Windows-based video refer to this: https://youtu.be/-1TOCDbmZmg 00:00 Introduction 00:15 Using the command line Prerequisites 00:54 Xdebug toggle 01:11 Visual Studio Code 01:22 TablePlus 01:39 Homebrew 02:14 Xcode command line tools Installing 03:06 Installing Homebrew 04:13 Configuring Visual Studio Code 04:53 Visual Studio Code extensions 06:32 Installing PHP, Apache, MariaDB and more 08:33 Setting up PHP extensions for the installed versions 10:03 PHP 5.6 10:41 PHP 7.4 11:43 PHP 8.0 12:36 Configuring MariaDB 14:52 Using Visual Studio Code to edit configuration 16:15 Apache configuration 19:37 PHP configuration 19:59 Cleaning up Xdebug and imagick php.ini directives 20:34 PHP conf.d 22:19 PHP FPM configuration for multiple version support 24:45 Starting services 25:40 Managing permission prompts 26:18 Testing with test.php 27:15 Using multiple version PHP support 29:40 Demo - debugging with Xdebug in Visual Studio Code 33:09 Installing XenForo 37:00 Tracing XenForo code execution with Xdebug 42:32 Demo - TablePlus 47:08 Conclusion Note: at 41:30, the debugger times out. Adding the line `Timeout 3600` to your `/usr/local/etc/httpd/extra/httpd-dev.conf` will fix this issue, but requesting an hour before time out occurs. The XenForo dev docs page has been updated to reflect this.

Download

0 formats

No download links available.

Run PHP 8.0, 7.4 and 5.6 simultaneously in a macOS development environment | NatokHD