Search code examples
amazon-web-servicesamazon-ec2imapphp-7.2

installing php-imap on amazon ec2 linux 2


I need to install php-imap on amazon ec2 linux 2 instance. All the php stuff is inside amzn2extra-lamp-mariadb10.2-php7.2 but php-imap package is missing. Any advice ?

Thanks


Solution

  • I installed it like this.

    I downloaded the php source code of the currently installed version in my Amazon Linux 2

    wget http://php.net/get/php-7.2.8.tar.bz2/from/a/mirror
    

    Unpacked it and went into php-7.2.8/ext/imap/

    Compiled extension:

    phpize
    ./configure
    

    I got some errors.

    Some U8T_CANONICAL stuff so

    sudo yum install libc-client-devel
    

    Then libc-client.a not found so created a symlink for it:

    cd /usr/lib
    sudo ln -s /usr/lib64/libc-client.a
    

    some other imap library error so:

    sudo yum install uw-imap-static
    

    I got some other errors so the working configure line was:

    ./configure --with-kerberos --with-imap-ssl
    make
    

    SUCCESS!

    cd php-7.2.8/ext/imap/modules
    sudo cp imap.so /usr/lib64/php/modules/
    

    Created an ini file to load it:

    sudo vi /etc/php.d/30-imap.ini
    

    added to the file this content:

    extension=imap
    

    restarted php service (you might need to restart httpd depending on your php installation):

    sudo systemctl restart php-fpm
    

    PHPinfo now contains: imap IMAP c-Client Version 2007f SSL Support enabled Kerberos Support enabled