André Angelantoni
André Angelantoni

Reputation: 161

Failed loading xdebug did found mach-o, but wrong architecture for php7

Whether I install via homebrew:

brew install homebrew/php/php70-xdebug

or compile from source located at http://xdebug.org using either just ./configure or the following:

./configure --enable-xdebug CC="gcc -arch i386" CXX="g++ -arch i386"
make

I still receive the following when running php7 that is bundled with Acquia DevDesktop:

Failed loading /Applications/DevDesktop/php7_0/ext/xdebug.so:  dlopen(/Applications/DevDesktop/php7_0/ext/xdebug.so, 9): no suitable image found.  Did find:
    /Applications/DevDesktop/php7_0/ext/xdebug.so: mach-o, but wrong architecture

Things I have confirmed:

The full message php --version returns is:

$ php --version
Failed loading /Applications/DevDesktop/php7_0/ext/xdebug.so:  dlopen(/Applications/DevDesktop/php7_0/ext/xdebug.so, 9): no suitable image found.  Did find:
    /Applications/DevDesktop/php7_0/ext/xdebug.so: mach-o, but wrong architecture
PHP 7.0.4 (cli) (built: Mar 18 2016 02:12:27) ( ZTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

The OS is a brand-new install of Mac OS 10.11.5 on a MacBook Air.

Does anyone know why is it complaining about the wrong architecture?

Upvotes: 5

Views: 1658

Answers (2)

sdmeyers
sdmeyers

Reputation: 259

This is what worked for me for DevDesktop:

  1. Download and extract the xdebug source code (I used xdebug-2.5.5).
  2. $ cd xdebug-2.5.5
  3. $ /Applications/DevDesktop/php7_0/bin/phpize

and now the step that was the one that caused most grief figuring out...

  1. $ ./configure --with-php-config=/Applications/DevDesktop/php7_0/bin/php-config CC="gcc -arch i386" CXX="g++ -arch i386"
  2. $ make
  3. $ cp modules/xdebug.so /Applications/DevDesktop/php7_0/ext/

  4. open the php7_0/bin/php.ini file and (assuming it is the default) replace:

    zend_extension="/Applications/DevDesktop/php5_6/ext/opcache.so"

with

;zend_extension="/Applications/DevDesktop/php5_6/ext/opcache.so"
[Xdebug]
zend_extension="/Applications/DevDesktop/php7_0/ext/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
  1. Stop and Start the server instance in DevDesktop and debug away.

Upvotes: 3

2myCharlie
2myCharlie

Reputation: 1927

• Open the php.ini file inside of Applications/DevDesktop/php(version#)/bin/php.ini
• Commented out the  following two lines:
    ○ zend_extension="/Applications/DevDesktop/php7_0/ext/xdebug.so"
    ○ xdebug.remote_enable=1
• Stop and restart DevDesktop

The comments in this thread works for me. Source: Install XDebug and load in Acquia Drupal Stack?

Upvotes: 0

Related Questions