1

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) ?

4 Answers 4

4

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

0
3

I have come across this while installing SSL for IMAP in MAMP on El Capitan. Ivan's solution is good, but I found several subsequent problems of the same type:

fatal error: 'openssl/bio.h'

Instead of changing the Makefile, create a symbolic link:

sudo ln -s /usr/local/Cellar/openssl/1.0.2a-1/include/openssl /usr/include/openssl

But to do this, you must first remove El Capitan's insane “safety” disability, as Ivan also mentioned. Boot while holding +R, launch terminal and write csrutil disable. Then reboot.

1
  • Be sure that the openssl version is the same like on your computer (1.0.2a-1 in the answer)
    – Yetispapa
    Commented Jun 15, 2016 at 15:47
1

While I realize this doesn't directly answer your questions, the easiest way to get PHP running with IMAP installed on OSX is by installing MAMP (https://www.mamp.info). It installs a second copy of PHP and Apache into it's own directory structure, so it makes for a great local development environment for this products.

The added bonus here is it won't touch your pre-installed PHP version, so if you don't like MAMP, you can just remove it. Very easy.

2
  • Oh, man. I already had MAMP installed, I just forgot to even look if its PHP had what I needed.... And it did! Thanks!
    – Dan Ray
    Commented Feb 29, 2016 at 20:58
  • 1
    Be aware that PHP bundled with MAMP is not compiled using --with-imap-ssl so if you need ssl, you're out of luck and will need to recompile yourself. Commented Mar 17, 2016 at 15:46
1

I am using this guide to install it on my Mamp environment worked for me

Not the answer you're looking for? Browse other questions tagged or ask your own question.