Search code examples
phpmacosapachemacos-mojave

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 i.e. 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


Solution

  • 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.