Home libphp7.so requires version 12.0.0 or later
Reply: 2

libphp7.so requires version 12.0.0 or later

BlackJack
1#
BlackJack Published in 2015-12-31 06:22:47Z

I have a fresh installation of OSX el capitan 10.11.2 and installed php7 using homebrew.Now getting following error

command

sudo apachectl -e info -k restart

error

httpd: Syntax error on line 171 of /private/etc/apache2/httpd.conf:
 Cannot load /usr/local/opt/php70/libexec/apache2/libphp7.so into server: dlopen(/usr/local/opt/php70/libexec/apache2/libphp7.so, 10):
 Library not loaded: /usr/local/opt/libxml2/lib/libxml2.2.dylib
  Referenced from: /usr/local/opt/php70/libexec/apache2/libphp7.so
  Reason: Incompatible library version: libphp7.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0

I have searched on google but didn't get any specific solution.

cmelone
2#
cmelone Reply to 2016-07-18 23:56:40Z

PLEASE DO NOT DO THIS!!! YOUR BEST BET IS TO REINSTALL MAC OS X

Alright, I just found a way. It is kinda hacky, but it works.

When trying to run PHP 7, apache checks for libxml2.2.dylib under /usr/lib. To check what version it is currently at, you can run otool -L /usr/lib/libxml2.2.dylib.

That will probably output something like this:

/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)

But Apache and PHP want version 12.0.0, so let's install it through homebrew.

brew install libxml2 libxslt libiconv

This will install libxml to something like /usr/local/Cellar/libxml2/2.9.4/lib. This directory will contain a file called libxml2.2.dylib.

If you run otool -L /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib, it will output:

/usr/local/opt/libxml2/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.4.0)

So THIS is the version PHP and Apache are looking for. We are going to want to move this file to /usr/lib. But not so fast, we already have a file named libxml2.2.dylib in that folder so lets just add the .bak extension just in case we need it again.

sudo mv /usr/lib/libxml2.2.dylib /usr/lib/libxml2.2.dylib.bak

Now we can move the file that homebrew installed to this directory.

sudo cp /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib /usr/lib

That's it! Now you should be able to run sudo apachectl -e info -k restart with no errors and PHP 7 should work correctly.

user3684669
3#
user3684669 Reply to 2016-06-12 23:30:45Z

Install libxml2 with brew,

brew install libxml2

add following line into ~/.bash_profile

export LIBRARY_PATH=/usr/local/Cellar/libxml2/2.9.4/lib/:$LIBRARY_PATH

The version "2.9.4" can be changed to current

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303368 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO