[英]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)? 有没有人知道如何使用配置文件(.ebextensions)在AWS Elastic Beanstalk上安装和启用PHP IMAP Extension?
I'm using 64bit Amazon Linux 2017.03 v2.4.0 running PHP 7.0.16 我正在使用运行PHP 7.0.16的64位Amazon Linux 2017.03 v2.4.0
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
中的配置文件,但它不工作,配置文件名phpini.config
在.ebextensions
目录下面的设置:
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. 通过显示
/etc/php-7.0.d/phpimap.ini
将其他.ini
文件解析为phpinfo()
,但不会安装IMAP。
2nd Way Using container_command
to install php-imap but i'm getting error. 第二种方式使用
container_command
安装php-imap但我收到错误。
container_commands:
install_php_imap:
command: yum install php55-imap
3rd Way Using combined commands
& files
, it is only success installing IMAP and the dependencies (php common) but it doesn't activate the IMAP 第三种方式使用组合的
commands
和files
,它只是成功安装IMAP和依赖(php常见),但它不会激活IMAP
a. 一种。 Create installdependencies.config in my .ebextensions by adding bellow script:
通过添加以下脚本在我的.ebextensions中创建installdependencies.config:
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:
通过添加以下脚本在我的.ebextensions中创建phpini.config:
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
. 第四办法,我加入测试
upload_max_filesize
, post_max_size
和extension=imap.so
到zzzphp.ini
和仅包括两个值是upload_max_filesize
和post_max_size
。 The extension=imap.so
not included into zzzphp.ini
file. extension=imap.so
未包含在zzzphp.ini
文件中。
Below are the script phpini.config
in .ebextensions
: 下面是
phpini.config
中的脚本.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. 提前致谢。
Finally it's work 最后它的工作
Create two files inside .ebextensions as follow: 在.ebextensions中创建两个文件,如下所示:
installdependencies.config , install php common if it is required installdependencies.config ,如果需要,安装php common
commands:
01_install_phpcommon:
command:
sudo yum -y install php70-common
phpini.config , install php imap and enable imap phpini.config ,安装php imap并启用imap
commands:
02_install_phpimap:
command:
sudo yum -y install php70-imap
files:
"/etc/php.d/zzzphp.ini":
mode: "644"
content: |
extension=imap.so
For me, below code in phpini.config solved the issue. 对我来说,phpini.config下面的代码解决了这个问题。 Please notice the folder names as per php version.
请注意php版本的文件夹名称。 My php version is 7.2 hence below code works:
我的PHP版本是7.2因此下面的代码工作:
commands:
install_phpimap:
test: '[ ! -f /etc/php-7.2.d/imap.ini ] && echo "php imap not installed"'
command:
sudo yum -y install php72-imap
files:
"/etc/php-7.2.d/imap.ini":
mode: "000755"
owner: root
group: root
content: |
extension=imap.so
You're including the php-imap extension in php's configuration file, but that's not sufficient to install it. 你在php的配置文件中包含了php-imap扩展,但这还不足以安装它。
You're going to have to pass something to your EBS provisioning method of choice telling it to install php-imap (or whatever it's called in that environment) at the system level. 您将不得不将某些内容传递给您选择的EBS配置方法,告诉它在系统级别安装php-imap(或在该环境中调用的任何内容)。
I followed all of the suggestions here but my commands kept on failing because my composer required imap support and the container commands are run after... Here's what worked for me: 我遵循了所有的建议,但我的命令仍然失败,因为我的作曲家需要imap支持,容器命令运行后......这对我有用:
packages:
yum:
php72-imap.x86_64: []
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.