Compile mailparse extension with mbstring dependency

Follow

Issue

Attempting to build mailparse extension using pecl / pear will fail as it has a static dependency with mbstring extension

Environment

Zend Server running on Red Hat / CentOs systems

Resolution

If you wish to build that extension successfully on Zend Server please execute the following steps carefully:

1. Make sure you have the following packages installed :

    yum install phpize
    yum install php-5.5-source-zend-server
    yum install gcc

2. Issue the following command from zend/bin

   ./pear install pecl/mailparse

   The installation will fail during the make stage of course but we have the downloaded package      ready for at /tmp/pear/download

3. In the above folder issue :

   tar -zxvf mailparse-2.1.6.tgz

4. change directory into the new folder deployed :

   cd mailparse-2.1.6

5. Execute the following command :

    /usr/local/zend/bin/phpize

   once that done execute :

   ./configure --with-php-config=/usr/local/zend/bin/php-config

6. Now we need to give that build the mbstring source code.

    create the ext folder :

    mkdir ext/

    copy the necessary files:

    cp -rf /usr/local/zend/share/php-source/ext/mbstring/ /tmp/pear/download/mailparse-2.1.6/ext/

7. Now we need to edit the mailparse.c file and remove that validation check

    vim mailparse.c

    Comment out lines 34 - 37 should look like this

     /* 
    #if !HAVE_MBSTRING
    #error The mailparse extension requires the mbstring extension!
    #endif
     */

    save and exit the editor.

8. Run the make command

   make

   once that's done

   make install

That should build the mailparse.so under/usr/local/zend/lib/php_extensions/

 

 

Have more questions? Submit a request

Comments

Powered by Zendesk