Search code examples
phpmacosimaposx-elcapitan

Add imap extension to PHP on OSX El Capitan


I'm working on a project where I need imap_open() function and I just bought my first Macbook Pro with OSX El Capitan on it.

I activated the extension in php.ini but the .so file is missing, searching on how to install imap extension doesn't work on El Capitan and while compiling I get error osdep.c:170:10: fatal error: 'x509v3.h' file not found

Anyone know what should I install in order to get that header file or is there any easy way to install extension like on Linux (yum install php5-imap, apt-get install php5-imap) ?


Solution

  • I had the same issue last week and managed to solve it. The problem is that imap make file assumes that your open ssl is located at /usr/include/openssl while on my mac it was at /usr/local/Cellar/openssl/1.0.2d_1/include/openssl

    You can use locate x509v3.h to find exact path

    Following the steps from here ... After step cd imap-2007f

    open the Makefile, search for OSX and change the ssl include path to your path

    That should solve compiling problems, so you will be able to go on till the last step where you need to copy imap.so to /usr/lib/php which will not be possible because of new SIP feature on El Capitan

    Have a look here how to override this restriction I hope it helps