简体   繁体   中英

How to compile and use php extensions on Mac OS Mojave

I have just installed the new OSX Mojave and as you know it comes with PHP 7.1.19 pre installed with just few extensions available.

First of all, I am not a fan of homebrew or any other package managers as well as disabling security utils ie csrutil.

I have successfully compiled intl extension but apache doesn't load it due to a code signing problem:

PHP Startup: Unable to load dynamic library 'intl.so' - dlopen(intl.so, 0x0009): code signature in (intl.so) not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed. in Unknown on line 0

Is there a way to sign the newly compiled extensions, probably using ad-hoc signing method or something?

I know there are lots of other topics about this issue but all are left unanswered or at most suggesting homebrew kind of workarounds!

Thanks

After days and days trying to get intl to work with the built-in php I ended up with a robust solution!

First I must say that this answer has nothing to do with code signing!

Here is what I have done, I ignored the built-in package( php, apache ) and compiled both from source and now I have the latest version of both installed with intl extension running like a charm, building new extensions is a piece of cake and php runs them without nagging :)

I don't really understand why people use homebrew for such a thing while you can easily compile libraries and extensions yourself.

I hope this answer helps someone out there.

I also have same problem. Everybody resolves the problem with homebrew...

codesign -vd /usr/lib/php/extensions/no-debug-non-zts-20160303/x.so
/usr/lib/php/extensions/no-debug-non-zts-20160303/x.so: code object is not signed at all


codesign -vd /usr/lib/php/extensions/no-debug-non-zts-20160303/opcache.so 
Executable=/usr/lib/php/extensions/no-debug-non-zts-20160303/opcache.so
Identifier=com.apple.opcache
Format=Mach-O thin (x86_64)
CodeDirectory v=20100 size=2914 flags=0x0(none) hashes=87+2 location=embedded
Platform identifier=5
Signature size=4485
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=1 size=68


codesign -vd /usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so 
Executable=/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
Identifier=com.apple.xdebug
Format=Mach-O thin (x86_64)
CodeDirectory v=20100 size=1985 flags=0x0(none) hashes=58+2 location=embedded
Platform identifier=5
Signature size=4485
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=1 size=64

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM