We don't need the actual application running.Īpple has made it unnecessarily complicated to build software from the command line by tucking away all of the libraries and headers in a non-standard folder. After it's done installing you can quit XCode. If you forget to do that you will get compilation errors when building PHP. This is the part where XCode installs the software and header files we need to build PHP. This is Apple's all-in-one development package which includes system headers and the all important build toolchain (C compiler, automake, autoconf and so on and so forth). Let's get started, then!īefore you begin your quest to a custom PHP version in MAMP you need a sane build environment with all the PHP dependencies installed.įirst, install XCode from the App Store. This is the source of all problems and please don't ask me to help you just like you, I search the error message I am getting and plow through the results until I find something which seems like a promising solution. If you get compilation errors check what you have installed in Homebrew and where you have linked it to. I used the former to come up with the instructions and the second, "virgin" machine to verify that everything works. One Mac Mini which was upgraded from macOS Sierra to High Sierra to Mojave and a MacBook Pro which was freshly installed with Mojave. I sometimes need to disable stuff to see if my code fails gracefully. Unlike MAMP, I try to build most of the extensions as "shared", i.e. This should not be an issue for most people.įinally, you will need to edit your PHP version's php.ini template file and manually enable additional PHP extensions. I compiled most PHP modules but I left some out because I don't use them and don't have the time to troubleshoot their build dependencies. Not unless you also install the dependencies outlined below with Homebrew. The actual caveat is that you can't just pluck the compiled PHP from your computer and install it on your mate's. We are going to use Homebrew to install the required PHP build dependencies. Likewise, they do not ship build headers for anything except PHP itself – definitely not for any of the build dependencies. FastCGI is also the only way PHP works on NginX. Just select the "Individual PHP version for every host (CGI mode)" option. The recommended way to run PHP 5.3 and later is through FastCGI. Therefore we are only building PHP CLI and CGI/FastCGI, not as an Apache module. Proceed at your own risk and peril.Īppsolute, the makers of MAMP, make it unnecessarily complicated – read: impossible – to compile your own Apache modules by not shipping the build headers for Apache. It will save you time, money and frustration (and keep you blissfully unaware of the gruesome process of compiling software from scratch). If you want quick results just wait a few months for MAMP PRO to include a new version of PHP. You will be searching online cryptic error messages only to find a million pages from five years ago which do not apply. This procedure is not for the faint of heart, if you don't have experience building stuff from source (and troubleshoot cryptic compile error message) or if you're in a mad dash to deliver software. "It's possible" does not mean "it's easy". This is of course a ridiculous lie they do it themselves so surely I can! This article walks you step by step to my process of adding PHP 7.3.0 to MAMP 5.2 on this lazy Saturday afternoon. According to MAMP's support "You cannot compile your own entire versions of PHP in MAMP PRO". I wanted to test my software against PHP 7.3 on macOS instead of just my Linux machines and / or Docker containers. It's possible - despite what MAMP's developers want you to believe. Compile your own PHP version from source and install it on MAMP PRO on macOS.
0 Comments
Leave a Reply. |