简体   繁体   English

如何在Mac OS Mojave上编译和使用php扩展

[英]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. 我刚刚安装了新的OSX Mojave,你知道它预装了PHP 7.1.19,只有几个扩展可用。

First of all, I am not a fan of homebrew or any other package managers as well as disabling security utils ie csrutil. 首先,我不是自制软件或任何其他软件包管理器的粉丝,也不是禁用安全工具,即csrutil。

I have successfully compiled intl extension but apache doesn't load it due to a code signing problem: 我已经成功编译了intl扩展,但是由于代码签名问题,apache没有加载它:

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? 有没有办法签署新编译的扩展,可能使用ad-hoc签名方法或其他什么?

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! 之后,好多天试图让intl与内置的PHP我结束了一个强大的解决方案而努力!

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 :) 这是我所做的,我忽略了内置的包(php,apache)并从源代码编译了两个,现在我已经安装了最新版本的intl扩展,像魅力一样运行,构建新的扩展是一块蛋糕和PHP运行它们没有唠叨:)

I don't really understand why people use homebrew for such a thing while you can easily compile libraries and extensions yourself. 我真的不明白为什么人们使用homebrew来做这样的事情,而你自己可以轻松地编译库和扩展。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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