PHP 7.0 with IMAP and MAILPARSE on MAC OS
After some troubleshooting, it finally worked..... That's how I did:
First I installed the following formulas:
brew install imap-uwbrew install openssl
After that, I downloaded the same version of the pho is running in my computer on http://php.net/downloads.php (saved it in Downloads folder).
In terminal I did.
cd ~/Downloads/php-7.0.29/ext/imap./configure --with-imap=/usr/local/Cellar/imap-uw/2007f --with-kerberos --with-imap-ssl=/usr/local/opt/opensslmake
where /usr/local/Cellar/
is the path where the formula imap-uw is installed.
P.S this configure file does not accept --with-openssl
or --with-openssl-dir
or +openssl
. I waist a lot of time trying that.
it created a folder modules/
with the imap.so
file inside.
Then I created a folder and moved the imap file to inside it
mkdir /usr/local/opt/php70-imapmv modules/imap.so /usr/local/opt/php70-imap/imap.so
After that just add the extension to the php.ini
file
extension="/usr/local/opt/php70-imap/imap.so"
Restart the server and imap will work fine!
For mailparse I had to use pecl.
First I followed this tutorial https://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/
After pecl
was installed properly in my computer, I ran the following code:
cdpecl download mailparsetar -xvf mailparse-3.0.2.tgz cd mailparse-3.0.2/phpize./configuresed -i 's/#if\s!HAVE_MBSTRING/#ifndef MBFL_MBFILTER_H/' ./mailparse.cmakemkdir /usr/local/opt/php70-mailparsesudo mv modules/mailparse.so /usr/local/opt/php70-mailparse/mailparse.so
I got the piece of code above here https://github.com/php-mime-mail-parser/php-mime-mail-parser . However the line sed -i 's/#if\s!HAVE_MBSTRING/#ifndef MBFL_MBFILTER_H/' ./mailparse.c
has not worked properly. I ran make
anyways and it worked.
After that just add the extension to the php.ini
file
extension="/usr/local/opt/php70-mailparse/mailparse.so"