Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Install PHP IMAP Extension on AWS Elastic Beanstalk Using Configuration Files (.ebextensions)?

Does anyone know how to install and enable PHP IMAP Extension on AWS Elastic Beanstalk using configuration files (.ebextensions)?

I'm using 64bit Amazon Linux 2017.03 v2.4.0 running PHP 7.0.16

I've tried several ways as follow:

1st Way I've tried using files in configuration file but it doesn't work, the configuration filename is phpini.config in .ebextensions directory with below setup:

files:
  "/etc/php.d/phpimap.ini":
    mode: "000755"
    owner: root
    group: root
    content: |
      extension=imap.so

The additional .ini files parsed into phpinfo() by displaying /etc/php-7.0.d/phpimap.ini but the IMAP won't installed.

2nd Way Using container_command to install php-imap but i'm getting error.

container_commands:
  install_php_imap:
    command: yum install php55-imap

Error as image below: error 2nd way

3rd Way Using combined commands & files, it is only success installing IMAP and the dependencies (php common) but it doesn't activate the IMAP

a. Create installdependencies.config in my .ebextensions by adding bellow script:

commands:
  install_phpcommon:
    test: '[ ! -f /etc/php.d/curl.ini ] && echo "php common not installed"'
    command:
      yum -y install https://archipelagointernational.s3.amazonaws.com/libs/php70w-common-7.0.16-1.w6.x86_64.rpm

b. Create phpini.config in my .ebextensions by adding bellow script:

commands:
  install_phpimap:
    test: '[ ! -f /etc/php.d/imap.ini ] && echo "php imap not installed"'
    command:
      yum -y install https://archipelagointernational.s3.amazonaws.com/libs/php70w-imap-7.0.16-1.w6.x86_64.rpm

files:
  "/etc/php.d/imap.ini":
    mode: "000755"
    owner: root
    group: root
    content: |
      extension=imap.so

4th Way I'm testing by adding upload_max_filesize, post_max_size and extension=imap.so to zzzphp.ini and only two values are included that are upload_max_filesize and post_max_size. The extension=imap.so not included into zzzphp.ini file.

enter image description here enter image description here

Below are the script phpini.config in .ebextensions:

commands:
  install_phpimap:
    test: '[ ! -f /etc/php.d/imap.ini ] && echo "php imap not installed"'
    command:
      yum -y install https://archipelagointernational.s3.amazonaws.com/libs/php70w-imap-7.0.16-1.w6.x86_64.rpm

files:
  "/etc/php.d/zzzphp.ini":
    mode: "644"
    content: |
      upload_max_filesize = 50M
      post_max_size = 58M
      extension=imap.so

Any suggestions?

Thanks in advance.

like image 691
Manellen Avatar asked Jan 30 '23 02:01

Manellen


1 Answers

Finally it's work

Create two files inside .ebextensions as follow:

installdependencies.config, install php common if it is required

commands:
  01_install_phpcommon:
    command:
      sudo yum -y install php70-common

phpini.config, install php imap and enable imap

commands:
  02_install_phpimap:
    command:
      sudo yum -y install php70-imap

files:
  "/etc/php.d/zzzphp.ini":
    mode: "644"
    content: |
      extension=imap.so
like image 159
Manellen Avatar answered Feb 03 '23 06:02

Manellen