Developer IDE and server software setup guides

Here at XenForo, we like to keep our development environments up-to-date and as useful as possible, and from time to time we include some of our findings in our online documentation.

macos-debugging.jpg


Recently, we've published an easy setup guide for a Windows-based development environment and now we've added both a guide for building a very flexible macOS-based system and instructions for setting-up a similar multi-PHP deployment in Linux.

Multiple, simultaneous PHP versions​


The macOS and Linux installation guides bring the ability to simultaneously run multiple versions of PHP with Xdebug without having to switch the active version.

This can be invaluable for developers who want to build new code with PHP 8, but also want to maintain add-ons written for legacy software like XenForo 1.5.

macos-php-versions.png


Step debugging with Xdebug​


Furthermore, we've provided setup instructions to get step debugging working with Visual Studio Code and Xdebug. If you're not already using Xdebug as part of your PHP development system, it's time to start!

While the guides describe step-debugging in VS Code, the principles can be applied to PhpStorm or any other step-debug-capable IDE.

Video guides​


Both the Windows and macOS guides can be found in the XenForo 2 Dev Docs, and have accompanying videos to help you through the setup process.

macOS - multiple simultaneous PHP versions

How to install Apache, MariaDB, ElasticSearch, MailHog, ImageMagick and three versions of PHP to run simultaneously under macOS

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
Note: I have updated the docs with an explanation of how to build the ImageMagick extension for PHP 8 manually, as the pecl install imagick command still doesn't work for PHP 8 - Kier

Ubuntu / Debian Linux - PHP 8.0, 7.4 and 5.6 at the same time

Configure Linux with three versions of PHP to run from a single Apache server at the same time

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Windows - super-easy setup

Install Apache, MySQL, PHP and Xdebug in just a few minutes

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Visual Studio Code - setup for PHP and Xdebug

Read the guide in the dev docs

linux-debugging.jpg
 
Last edited by a moderator:
I agree completely, and PhpStorm is our daily driver here at XF, but as a free option, VS Code is brilliant.
PhpStorm is really nice based on the trials I've done. It catches a lot of errors that Eclipse misses. We've been stuck on Eclipse for a while now. How have you managed / worked around PhpStorm's auto-save "features"?

It really bugs me that it automatically saves everything that's open every few seconds, and without prompting on exit, and that the developers of PhpStorm seem to be against allowing the auto-save to be disabled. In my experience, this kind of "Save all" has led to unintentional overwrites (leading to additional development time rewriting the same code over) and saving of uncompleted file edits (leading to parse errors when I just want to test something else I had open).
 
PhpStorm is really nice based on the trials I've done. It catches a lot of errors that Eclipse misses. We've been stuck on Eclipse for a while now. How have you managed / worked around PhpStorm's auto-save "features"?

It really bugs me that it automatically saves everything that's open every few seconds, and without prompting on exit, and that the developers of PhpStorm seem to be against allowing the auto-save to be disabled. In my experience, this kind of "Save all" has led to unintentional overwrites (leading to additional development time rewriting the same code over) and saving of uncompleted file edits (leading to parse errors when I just want to test something else I had open).
This may be of interest to you: https://gist.github.com/d1i1m1o1n/13845f4f8b0564a58d9753cf28e197b2

Not sure how well it'll work for you, but one of my developers found that when he switched to other Jetbrain products.
 
Excellent tutorial thanks @Kier, am starting out on my php journey bringing my own special blend of hack and slash to coding and the tutorial certainly helped :).
 
How to use it? Can you guide me? Thank you.
Theoreotically the same procedure to what Kier demonstrated, except:

1. macPorts requires sudo access to operate.
2. macPorts won't get interfered by cross-national firewalls since it has multiple mirrors around the world. Homebrew usability depends on whether you can use GitHub without a problem.
3. Unless you deliberately compile-install macPorts to /usr/local/ (some people do this to ensure compatibility with existing shell scripts written for Homebrew), you are supposed to change /usr/local/ to /opt/local/ folder.
4. in macPorts, phps are not phps but consists of separated commands: php56, php70, php71, php72, php73, php74, php80, etc.
5. to load PHP (if macPorts php installer doesn't automatically help you configure this), add this module LoadModule php_module lib/apache2/modules/mod_php80.so to your httpd.conf or your site definition file referred by httpd.conf file.
 
I noticed that If you use an Apple Silicon Device with M1 chip, you must change '/usr/local/' to '/opt/homebrew/'
Thanks for this!

It's a pretty important note, especially for the MariaDB setup. The files were found in /opt/homebrew on my Apple Silicon M1 MacBook with Big Sur 11.5.2. I'm not using MacPorts.
 
Top Bottom