Hero Image

Mailparse php module ZTS and TS version on AMI 2018 linux

Note: this article assumes you have php72 installed

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

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 to ini file

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

Restart apache

service httpd restart

Verify that module is loaded

For cli php:

php-7.2 -m |grep mailparse

Other Related Posts:

PHP and NGINX on Amazon Linux AMI

Install NGINX

sudo yum install nginx -y

Install PHP and PHP-FPM

sudo yum install php -y
sudo yum install php-fpm -y

Configure NGINX (see below)

sudo nano /etc/nginx/conf.d/default.conf
server {
    listen 80;
    server_name www.exampledomain.tld exampledomain.tld;

    location / {...

Read more

20th Jan 2019