Skip to content

Instantly share code, notes, and snippets.

@napestershine
Created January 31, 2022 12:53
Show Gist options
  • Select an option

  • Save napestershine/7d6073bf23ef8918b7b7001410be0c96 to your computer and use it in GitHub Desktop.

Select an option

Save napestershine/7d6073bf23ef8918b7b7001410be0c96 to your computer and use it in GitHub Desktop.
Install IMAP extension on Amazon Elastic Beanstalk PHP Amazon Linux 2 Platform
#!/bin/bash
PATH=pwd
sudo yum groupinstall "Development Tools" -y
sudo amazon-linux-extras install epel -y
sudo yum install epel-release
sudo yum install libc-client-devel uw-imap-static openssl-devel -y
sudo ln -s /usr/lib64/libc-client.a /usr/lib
cd ~
PHP_VERSION=$(php -r "echo PHP_VERSION;")
wget https://www.php.net/distributions/php-"${PHP_VERSION}".tar.gz
tar -xf php-"${PHP_VERSION}".tar.gz
cd php-"${PHP_VERSION}"/ext/imap
phpize
./configure --with-kerberos --with-imap-ssl
make
cd modules
sudo cp imap.so /usr/lib64/php/modules/
sudo touch /etc/php.d/30-imap.ini
sudo echo 'extension=imap.so' >> /etc/php.d/30-imap.ini
sudo systemctl restart php-fpm
sudo systemctl restart httpd
cd ${PATH}
@w2leo
Copy link

w2leo commented Mar 12, 2024

@i7strelok2 @w2leo Have you found solution or I update it?

Not yet. For AWS Linux 2023 I have no solution yet. If you have and can share - it would be great!

@kirilcvetkov
Copy link

kirilcvetkov commented Sep 6, 2024

A major bug in this script is using PATH as a temporary storage for the current path (pwd). It overwrites the paths to the commands and then the script doesn't know where "cd", "sudo", "yum", "amazon-linux-extras" are anymore. It is good to change paths to the users folder when building the imap.so file but make sure to use a variable that doesn't collide with the working system variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment