Fixing PHP Compilation Failures and ld/ldconfig Issues on CWP with CentOS 8/AlmaLinux 8
Fixing PHP Compilation and ld/ldconfig
Issues on CWP (CentOS 8 / AlmaLinux 8)
CentOS Web Panel (CWP) is a powerful hosting control panel, but when installed on CentOS 8 or AlmaLinux 8, some users face annoying problems like PHP compilation failures or strange ld
/ ldconfig
behavior. These issues often arise due to outdated toolchains, missing development libraries, or broken shared library links.
Why Does PHP Compilation Fail?
- Outdated GCC or binutils: Older versions of compilers or linkers can break PHP builds.
- Missing Development Tools: Libraries like
libxml2-devel
orlibpng-devel
are crucial. - Broken ld/ldconfig: Damaged symlinks or misconfigured library paths.
- Conflicting Repositories: Misconfigured Remi or EPEL repositories causing version clashes.
Step-by-Step Solutions
1. Update Toolchain and Dev Tools
sudo dnf update -y
sudo dnf groupinstall "Development Tools" -y
sudo dnf install gcc gcc-c++ make automake autoconf libtool -y
sudo dnf install binutils binutils-devel -y
ld --version
2. Repair ldconfig
Links
sudo ldconfig
sudo /sbin/ldconfig -v
Ensure /etc/ld.so.conf.d/
contains:
/usr/local/lib
/usr/lib64
3. Install PHP Build Dependencies
sudo dnf install libxml2-devel bzip2 bzip2-devel curl-devel \
libjpeg-devel libpng-devel libXpm-devel freetype-devel \
gmp-devel mariadb-devel aspell-devel recode-devel \
libicu-devel oniguruma-devel sqlite-devel libxslt-devel zip unzip
4. Clean and Recompile PHP
cd /usr/local/src
rm -rf php*
sh /scripts/php-selector recompile 8.1
5. Fix ld
if Corrupted
sudo dnf reinstall binutils
sudo ln -sf /usr/bin/ld.bfd /usr/bin/ld
Conclusion
By updating your build toolchain, repairing ldconfig
, and installing the right libraries, you can easily fix PHP compilation issues and ld
errors on CWP running CentOS 8 or AlmaLinux 8.
Want a one-click solution? Get the Auto-Fix Script