M1ke

PHP Library Error when run from Shell

There's a well documented problem of searching for answers on the internet, which is that people find interesting workarounds to problems but don't comment on the forums or blog posts where the original answer came from. Places like StackOverflow address this problem somewhat, but I think good practice for every developer should be to make note online of problems encountered, along with how they solved it. Now that I have a blog it seems ideal that I follow my own advice.

I encountered the following error whilst running one of my website scripts from shell (which I was doing to test how it would run from Crontab).

error while loading shared libraries: libdb-4.3.so: cannot open shared object file: Error 23

My server in this case is hosted by 1&1 and runs CentOS 5.6. I found a thread on LinuxQuestions which had a few suggestions. It turned out that I didn't have the libdb files installed so running

$ yum install db4

Was all that was needed to solve the problem. You can run $ /usr/lib/libdb-4.3.so if you want to check if the files are already present. If they are, just replace install with reinstall in the yum command above.

Find us on StuRents