5/20/2023 0 Comments Php for mac os![]() ![]() It uses the built-in Apache on macOS, doesn’t require SIP to be disabled, and uses codesigning to validate the loaded modules for Apache. The resulting package can then be installed on any macOS system and doesn’t require Homebrew to be installed and doesn’t have any external dependencies. LoadModule php7_module "/usr/local/mds-php/lib/libphp7.so" "Developer ID Application: Twocanoes Software, Inc. The common name of the certificate that signed it must be specified as well. Using the Apache PHP module requires updating the apache config file to reference the new module. The resulting folder (“mds-php-universal”) was then packaged up and the files in that folder were installed to /usr/local/mds-php with the MDS package installer. /mds-php-arm/bin/phpĬodesign -v -force -o runtime -sign "Developer ID Application: Twocanoes Software, Inc. /mds-php-arm/lib/"$file"Ĭodesign -v -force -o runtime -sign "Developer ID Application: Twocanoes Software, Inc. The files were also signed and hardened so both Apache and notarization would accept them #!/bin/bash Homebrew does not cross compile packages easily, so the script was run on an M1 mac and the resulting binaries were combined using lipo. Since MDS runs on both macOS on Intel and Apple Silicon, this same process was repeated on Apple Silicon. Instead of including the install files inside the app, it is installed into /usr/local/mds-php7 and all libraries are linked to the lib folder in that location. The python relocate script was then updated to hardcode the path to where the destination php would be installed. However, apache does not allow rpath unless SIP is disabled. The script originally updated the libraries to use relative links (rpath) so that the folder could be moved around on the destination and it would still work. Once that script is run, the destination folder (“mds-php”) contains a bin and lib folder containing the php binary, the apache module (libphp7.so), and all required libraries. The libraries required by the libphp7.so module and the php binary are send to a great script by Andy Duplain that looks at all the linked libraries, collects them up into a single folder, and updates the link references. When the script is run, PHP 7 will be installed in the custom brew folder. #!/bin/sh -xĮcho "installing curl otherwise php install will fail" ![]() There seems to be a missing dependency on curl so that had to be installed separately. To build PHP in a non standard location, Homebrew needs to be installed in target folder and then all the software will then be installed in that location: git clone Īny brew commands can then run and the packages will be installed in that location. Building with Homebrew in Non-Standard Location For this to work, all the references in PHP and linked libraries need to be updated to point to the new folder. To make this easier, homebrew was used to install PHP 7 and the libraries in a temporary location and then all the libraries we collected to a single folder for easy deployment. It also required the Apache plug in system to build. To compile PHP, most of these libraries would need to be included since most are not included with macOS. PHP links to many external libraries libphp7.so: ![]() ![]() To resolve this issues, PHP 7 needs to be compiled, signed, and distributed with MDS. Even worse, after installing via Homebrew, it still did not work due to the new Apache requirements to only allow signed modules to be loaded: No code signing authority for module at libexec/libphp7.so specified in LoadModule directive.Ĭode signing absent - not loading module at: libexec/libphp7.so Compiling and Signing It required anyone using MDS to install PHP via Homebrew, which requires the Xcode command line tools. The most obvious way to solve this is to use the macOS package manager Homebrew. In order to get MunkiReport to work, PHP 7 need to be installed Considered Homebrew macOS still includes Apache, but not PHP. MDS, our macOS deployment tool, hosts MunkiReport, which depends on the apache PHP module to function. Any applications that required PHP 7 broke. MacOS 12 (Monterey) removed PHP7 in Apple’s ongoing effort to remove scripting languages from macOS. ![]()
0 Comments
Leave a Reply. |