Amazon Linux 2 php 7.4 php-imap fix
I think it’s fucking retarded that Amazon does not build imap support in their upstream main php repo. They should probably take one of their million developers and just fix this and not make us have to use other repos or start to manually maintaining their bullshit php package.
So Amazon go fuck yourself and fix your shit.
Step 1. Enable php 7.4 support in Amazon Linux 2
amazon-linux-extras enable php7.4
Step 2. Install your regular php packages
Step 3. Download the Source
cd ~
yumdownloader --source php
# Yum will download a file called php-7.4.xxx.amzn2.src.rpm
rpm -ihv php-7.4.xxx.amzn2.src.rpm
cd ~rpmbuild/SPECS/
# open php.spec with your favorite editor look for with_libcclient # and change to 1
with_libcclient 1
# Save
Step 4.Install Development tools
yum group install "Development Tools"
Step 5. Install php required packages
Since these packages might change from version to version i won’t post them here.
cd ~rpmbuild/SPECS/
rpmbuild -ba php.spec
# You will get a list of required packages just install them with yum
#Example
rpmbuild -ba php.spec
bzip2-devel is needed by php-7.4.11-1.amzn2.x86_64
curl-devel >= 7.9 is needed by php-7.4.11-1.amzn2.x86_64
httpd-devel >= 2.0.46-1 is needed by php-7.4.11-1.amzn2.x86_64
pam-devel is needed by php-7.4.11-1.amzn2.x86_64
sqlite-devel >= 3.6.0 is needed by php-7.4.11-1.amzn2.x86_64
libedit-devel is needed by php-7.4.11-1.amzn2.x86_64
libtool-ltdl-devel is needed by php-7.4.11-1.amzn2.x86_64
libzip-devel >= 0.11 is needed by php-7.4.11-1.amzn2.x86_64
systemtap-sdt-devel is needed by php-7.4.11-1.amzn2.x86_64
libacl-devel is needed by php-7.4.11-1.amzn2.x86_64
systemd-devel is needed by php-7.4.11-1.amzn2.x86_64
libc-client-devel is needed by php-7.4.11-1.amzn2.x86_64
cyrus-sasl-devel is needed by php-7.4.11-1.amzn2.x86_64
openldap-devel is needed by php-7.4.11-1.amzn2.x86_64
postgresql-devel is needed by php-7.4.11-1.amzn2.x86_64
unixODBC-devel is needed by php-7.4.11-1.amzn2.x86_64
libxml2-devel is needed by php-7.4.11-1.amzn2.x86_64
net-snmp-devel is needed by php-7.4.11-1.amzn2.x86_64
libxslt-devel >= 1.0.18-1 is needed by php-7.4.11-1.amzn2.x86_64
libxml2-devel >= 2.4.14-1 is needed by php-7.4.11-1.amzn2.x86_64
oniguruma-devel is needed by php-7.4.11-1.amzn2.x86_64
libjpeg-devel is needed by php-7.4.11-1.amzn2.x86_64
freetype-devel is needed by php-7.4.11-1.amzn2.x86_64
libXpm-devel is needed by php-7.4.11-1.amzn2.x86_64
libwebp-devel is needed by php-7.4.11-1.amzn2.x86_64
gmp-devel is needed by php-7.4.11-1.amzn2.x86_64
libdb-devel is needed by php-7.4.11-1.amzn2.x86_64
tokyocabinet-devel is needed by php-7.4.11-1.amzn2.x86_64
aspell-devel >= 0.50.0 is needed by php-7.4.11-1.amzn2.x86_64
libicu-devel >= 4.0 is needed by php-7.4.11-1.amzn2.x86_64
enchant-devel >= 1.2.4 is needed by php-7.4.11-1.amzn2.x86_64
pkgconfig(libsodium) >= 1.0.9 is needed by php-7.4.11-1.amzn2.x86_64
yum install bzip2-devel curl-devel httpd-devel pam-devel sqlite-devel libedit-devel libtool-ltdl-devel libzip-devel systemtap-sdt-devel libacl-devel systemd-devel libc-client-devyrus-sasl-devel openldap-devel postgresql-devel unixODBC-devel libxml2-devel net-snmp-devel libxslt-devel libxml2-devel oniguruma-devel libjpeg-devel freetype-devel libXpm-devel libwebp-devel gmp-devel libdb-devel tokyocabinet-devel aspell-devel libicu-devel enchant-devel libsodium
#Make sure to install libsodium-devel
Step 6. Recompile php with imap support and install the missing extension.
cd ~rpmbuild/SPECS/
rpmbuild -ba php.spec
....
# once done compiling
yum install ~/rpmbuild/RPMS/x86_64/php-imap-xxx.amzn2.x86_64.rpm
Step 7. go fuck yourself Amazon