Mailparse php module ZTS and TS version on AMI 2018 linux

Primary tabs

Note: this article assumes you have php72 installed

First install php72 development files

yum install php72-devel

Change to temporary folder

cd /tmp/

Download mailparse source code (you can also download specific version from http://pecl.php.net/package/mailparse)

wget https://github.com/php/pecl-mail-mailparse/archive/master.zip

Unzip source code

unzip master.zip

Change to mailparser folder

cd pecl-mail-mailparse-master

First compile regular TS version

phpize
./configure
make

Copy mailparser module to php modules folder

cp modules/mailparse.so /usr/lib64/php/7.2/modules/mailparse.so

Add to ini

echo "extension=mailparse.so" > /etc/php.d/mailparse.ini

Clean install

make clean

Now compile ZTS (Zend Thread Safety) version

zts-phpize
./configure --with-php-config=/usr/bin/zts-php-config
make 

Add to php modules

cp modules/mailparse.so /usr/lib64/php-zts/7.2/modules/mailparse.so

Add ini file

echo "extension=mailparse.so" > /etc/php-zts.d/25-mailparse.ini

Restart apache

service httpd restart

Verify that module is loaded

zts-php-7.2 -m |grep mailparse

For cli php:

php-7.2 -m |grep mailparse


QR Code for https://setupexample.com/mailparse-php-module-zts-and-ts-version-ami-2018-linux