Lampp – error while loading shared libraries: libc.so.6 xampp – Centos

Recently while restarting lampp server I got following error, which is used to work previously:

cat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/bin/sh: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
Starting XAMPP for Linux ...
/bin/bash: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/bin/bash: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/bin/bash: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/bin/bash: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
/bin/bash: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
XAMPP for Linux started.

To resolve this issue I read some forums, tried some solutions. After struggling couple hours I got the solution.

Following is the solution that worked for me:

OpenĀ lampp file in your server and search for the lineĀ redhat-release.

Most probably you can find this at line number 50 in laamp script, it should looks like following:

if egrep "Fedora" /etc/redhat-release > /dev/null

For CentOS we need to replace Fedora with CentOS, after changing like looks like following:

if egrep "CentOS" /etc/redhat-release > /dev/null

After making above changes try to start lampp with following and it should work without any issue.

$ /opt/lampp/lampp start
or
./lampp start

where /opt/lampp is root directory of lampp server.

-Sany