Local 9.0.4: PHP library architecture errors on Apple Silicon

Bug Summary

After upgrading to local 9.0.4 on Apple Silicon, running PHP commands in a site shell results in error messages about libraries not being available for ARM64 architecture.

Steps to reproduce

  1. Update Local to 9.0.4 on Apple Silicon.
  2. Start a website on PHP 8.0.30 and open the site shell.
  3. Type PHP --version

Expected:
I will see a message about PHP version.

Actual
I get an error related to libraries missing for ARM64 (see supporting info). At the end of the error message output, the final PHP version reported is v8.2.14, which is not what I configured in my container. Even if I set the container version to PHP 8.3.8, I still get v8.2.14 reported in the output, including the same errors.

See supporting info for detailed log.

Environment Info

Describe your environment.

  • MacBook Pro / Apple M1 Pro / Sonoma 14.4.1,
  • Apache / PHP 8.0.30 / MySQL 8.0.16 / WP 6.5.5
  • Local Version 9.0.4+6699

Supporting info

This is the full output of php --version command:


WP-CLI: WP-CLI 2.10.0

Composer: 2.6.2 2023-09-03

PHP: 8.0.30

MySQL: mysql Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)


Launching shell: /bin/zsh …

public php --version

Failed loading /Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so: dlopen(/Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so, 0x0009): tried: ‘/Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64e’ or ‘arm64’)), ‘/System/Volumes/Preboot/Cryptexes/OS/Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so’ (no such file), ‘/Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64e’ or ‘arm64’))

Warning: PHP Startup: Unable to load dynamic library ‘/Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so’ (tried: /Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so (dlopen(/Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so, 0x0009): tried: ‘/Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64e’ or ‘arm64’)), ‘/System/Volumes/Preboot/Cryptexes/OS/Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so’ (no such file), ‘/Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64e’ or ‘arm64’))), /lib/php/extensions/no-debug-non-zts-20220829//Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so.so (dlopen(/lib/php/extensions/no-debug-non-zts-20220829//Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so.so, 0x0009): tried: ‘/lib/php/extensions/no-debug-non-zts-20220829//Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so.so’ (no such file), ‘/System/Volumes/Preboot/Cryptexes/OS/lib/php/extensions/no-debug-non-zts-20220829//Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so.so’ (no such file), ‘/lib/php/extensions/no-debug-non-zts-20220829//Users/petervukovic/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin/lib/php/extensions/no-debug-non-zts-20200930/imagick.so.so’ (no such file))) in Unknown on line 0

PHP 8.2.14 (cli) (built: Dec 23 2023 00:10:54) (NTS)

Copyright (c) The PHP Group

Zend Engine v4.2.14, Copyright (c) Zend Technologies

with Zend OPcache v8.2.14, Copyright (c), by Zend Technologies

Update:

The issue was caused by multiple problems:

  1. I had an x86 binary of Local installed, and for some reason, it was working and updating itself properly even though I am on Apple Silicon. I replaced it with an ARM64 binary from the releases page.

  2. I had PHP versions installed by both Homebrew and Laravel Herd. Had to uninstall them all to get Local shell to work properly.

This post was extremely helpful:

2 Likes

Thank you for sharing the update @peter_vukovic!

2 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.