TechFanDan
TechFanDan

Reputation: 3478

APC - Unable to load dynamic library

Here is what I have in my PHP.ini:

extension=php_apc.dll
...    
[APC]
apc.enabled = 1

I'm running Apache 2.0.59, PHP version 5.2.3 on Windows Server 2003.

I've already installed XDebug compiled with vc6. Thus, I got the APC version 5.2 vc6. Here are both filenames that I downloaded (and put the *.dll in php/ext/).

php_apc-3.1.5-5.2-vc6-x86.zip php_apc-3.1.5-5.2-nts-vc6-x86.zip

I got them here.

I've tried rebooting the server and in both cases, I get the following error:

PHP Warning:  PHP Startup: Unable to load dynamic library './ext/php_apc.dll' - The specified module could not be found.\r\n in Unknown on line 0

Upvotes: 2

Views: 14415

Answers (7)

sh6210
sh6210

Reputation: 4540

In my case, I'm using macOS Catalina and was trying to install extension APCU for PHP 5.6.

So i ran below commands:

  1. brew install autoconf
  2. pecl channel-update pecl.php.net
  3. pecl install apcu-4.0.11

At this stage my php5.6 ini got input extension="apcu.so" But i was getting warning saying the apcu.so wasn't found under /usr/local/lib/php/pecl/20131226/ directory.

The installer put the apcu.so at /usr/local/Cellar/[email protected]/5.6.40/pecl/20131226/apcu.so

so i copied the apcu.so to the desired directory

cp /usr/local/Cellar/[email protected]/5.6.40/pecl/20131226/apcu.so /usr/local/lib/php/pecl/20131226/

and i'm done.

Upvotes: 0

Jazerix
Jazerix

Reputation: 4801

My problem was that I had listed apcu before apc.

extension=apc
extension=apcu

Reordering them so apcu was first, solved my issue.

Upvotes: 0

Maxime Pacary
Maxime Pacary

Reputation: 23061

To complete other answers:

Using the non thread safe (NTS) version of the DLL instead of the thread safe one solved the problem for me.

That is, only the NTS version was compatible with my WAMP installation.

Upvotes: 1

fred
fred

Reputation: 1

You have to be sure that the DLL has the correct architecture level. I had the same problem trying to load the file from php_apc-3.1.10-5.4-vc6-x86.zip. It didn't work, while the DLL from php_apc-3.1.10-5.3-vc6-x86.zip worked. I don't know how to find the right file without fiddling in the PHP repository though. HTH.

Upvotes: 0

TechFanDan
TechFanDan

Reputation: 3478

  1. First, I went here
  2. Then, I downloaded Collection of PECL modules for PHP 5.2.3
  3. Then, I extracted the php_apc.dll file and copied it in the ext/ folder
  4. Restarted Apache
  5. It works!

Upvotes: 1

nimmen
nimmen

Reputation: 111

You could check this:

Note: On Windows, APC needs a temp path to exist, and be writable by the web server. It checks the TMP, TEMP and USERPROFILE environment variables in that order and finally tries the WINDOWS directory if none of those are set.

http://php.net/manual/en/apc.installation.php

Upvotes: 0

jcmeloni
jcmeloni

Reputation: 1234

Try using the full drive letter and path to extension_dir in php.ini:

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "C:\somedir\php\ext"

And restart Apache after making the change.

(It might very well be something else, but this is the first thing I check on Windows systems -- those pesky filepaths.)

Upvotes: 5

Related Questions