Created
January 31, 2022 12:53
-
-
Save napestershine/7d6073bf23ef8918b7b7001410be0c96 to your computer and use it in GitHub Desktop.
Install IMAP extension on Amazon Elastic Beanstalk PHP Amazon Linux 2 Platform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.