PHP warning - Unable to load dynamic library ./ (Solution)

While installing the PHP APC opcode cache, I just ran into the following error:

PHP Warning:  PHP Startup: Unable to load dynamic library './' - ./ 
cannot open shared object file: No such file or directory in Unknown on line 0

I found this error message in my PHP error log, but depending on your configuration I think it may also be in your Apache error log file.

I finally figured out that this was because the extension_dir in my php.ini file was configured to look in the current directory ("./"), which was incorrect. In short, it looked like this:

extension_dir = "./"

and I changed it to this:

extension_dir = "/usr/local/php/extensions/no-debug-non-zts-20060613"

which is where my module was located. Once I made this change and restarted Apache, the "Unable to load dynamic library './'" error message went away.

I'm sure there are other reasons for getting an "Unable to load dynamic library" error message, but when I saw the "No such file or directory" message, and the reference to the "./" directory, I figured there was a configuration error somewhere.