homebrew - Can't install phalcon php on Apple M1 Pro
I've been trying to install Phalcon 3.4 on my xampp PHP 7.3 setup (Macbook Pro 16 M1 Pro chip). Following I've tried:
Tried with macports, but it is installing the file in /opt/local/lib/php73/extensions/no-debug-non-zts-20180731/phalcon.so, so I'm trying to copy this file to the xamppfiles/lib/php/extensions folder. But in the php_error_log file saying arm chip not supported by x86_64 file. Error log file:
[30-Oct-2021 15:34:16 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20180731/phalcon.so' (tried: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20180731/phalcon.so (dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20180731/phalcon.so, 0x0009): tried: '/Applications/XAMPP/xamppfiles/lib/phalcon.so' (no such file), '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20180731/phalcon.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/phalcon.so' (no such file), '/usr/lib/phalcon.so' (no such file)), /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20180731//Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20180731/phalcon.so.so (dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20180731//Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20180731/phalcon.so.so, 0x0009): tried: '/Applica in Unknown on line 0
Answer
Solution:
The error message
(have 'arm64', need 'x86_64')
indicates thatxampp
is a x86_64 app, butphp73-phalcon3
installed from macport is of arm64. You could try to download x86 version ofphp73-phalcon3
. uncompress and copyphalcon.so
to your xampp extension directory.Answer
Solution:
As of now Phalcon < 3.* is not supported by the the arm64-based chips. Phalcon > 4.* is supporting arm64-based chips.
My solution to the problem was to deploy a docker ubuntu image and run the project until we don't upgrade to newer version of Phalcon. This is working fine after almost 30h+ in already.
Answer
Solution:
You'll probably need to go the Docker route: https://github.com/MilesChou/docker-phalcon
I've done this on a M1 Pro and it works.
Might be able to use https://www.vagrantup.com/ as well, but I haven't tried that on M1. It's worked well in the past though.
Source