1. Home
  2. Programming Tools
  3. PHP Startup Error : Unable to load dynamic library, wrong ELF class: ELFCLASS64 [Solved]

PHP Startup Error : Unable to load dynamic library, wrong ELF class: ELFCLASS64 [Solved]

PHP thrown this error PHP Warning:  PHP Startup: Unable to load dynamic library wrong ELF class: ELFCLASS64, while installing Composer on my CentOS box having PHP version 5.3.3. Below is the complete error message:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/gd.so' - /usr/lib/php/modules/gd.so: wrong ELF class: ELFCLASS64 in Unknown on line 0

What could be the issue?

Solution:

According to the error message, PHP seems to have problem in loading gd.so and it has something to do with ELFCLASS64. It means, PHP is 32 bit installation and the GD library is 64 bit installation.

php dynamic library error

To check this, you need to run few commands as below:

$ file `which php`

(or)

$ file /usr/bin/php

Sample output:

/usr/bin/php: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), stripped

The above output says that PHP is ELF 32 bit executable.

Now, check GD library as below:

$ file /usr/lib/php/modules/gd.so
/usr/lib/php/modules/gd.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), stripped

The above output says that gd.so is ELF 64bit shared object, which is clearly the reason for “wrong ELF class” error.

So, the solution is to install PHP with 64 bit support.

Updated on September 3, 2017

Was this article helpful?

Related Articles

Leave a Comment