PROBLEM:
Alt-PHP 7.4 has IMAP enabled in PHP Selector, but imap_open() is unavailable.
SYMPTOM:
IMAP shows enabled in PHP Selector, but:
bool(false)
bool(false)
or:
libc-client.so.2007 => not found
CHECK:
Run as root:
ldd /opt/alt/php74/usr/lib64/php/modules/imap.so | grep -E 'libc-client|not found'
If you see:
libc-client.so.2007 => not found
check the library:
ls -l /opt/alt/libc-client11/lib64/libc-client.so.2007
CAUSE:
The CloudLinux libc-client library exists, but the system dynamic linker does not know the library path.
Library:
/opt/alt/libc-client11/lib64/
FIX:
Run as root:
cat > /etc/ld.so.conf.d/alt-php-libc-client.conf <<'EOF'
/opt/alt/libc-client11/lib64
EOF
ldconfig
VERIFY:
ldconfig -p | grep 'libc-client.so.2007'
Then:
ldd /opt/alt/php74/usr/lib64/php/modules/imap.so | grep -E 'libc-client|not found'
It should show:
libc-client.so.2007 => /opt/alt/libc-client11/lib64/libc-client.so.2007
FINAL PHP TEST:
/opt/alt/php74/usr/bin/php \
-d extension=imap.so \
-r 'var_dump(extension_loaded("imap"), function_exists("imap_open"));'
Expected:
bool(true)
bool(true)
IF USING CAGEFS:
cagefsctl --force-update
cagefsctl -e USERNAME
php -r 'var_dump(extension_loaded("imap"), function_exists("imap_open"));'
Expected:
bool(true)
bool(true)
IMPORTANT:
Do NOT modify imap.so with patchelf.
Do NOT manually copy libc-client.so.2007.
Do NOT install the cPanel EA4 libc-client package for an Alt-PHP problem.
Do NOT add LD_LIBRARY_PATH to .htaccess.
USE:
alt-php74-imap
alt-php-libc-client11
/opt/alt/libc-client11/lib64/
ROOT CAUSE:
imap.so requires libc-client.so.2007, but /opt/alt/libc-client11/lib64 was missing from the dynamic linker configuration.
RESOLUTION:
Add /opt/alt/libc-client11/lib64 to /etc/ld.so.conf.d/ and run ldconfig.