How to Fix Unable to Load Dynamic Library in Php

This problems are often encountered on new php installation.

Solution:

1.) Add these lines to httpd.conf


PHPIniDir "C:/php-5.2.10"
LoadFile "C:/php-5.2.10/php5ts.dll"
LoadModule php5_module "C:/php-5.2.10/php5apache2_2.dll"
AddType application/x-httpd-php .php


2.) In your php.ini, set
a.) session save directory: session.save_path = C:\php-5.2.10\session_dir
b.) upload directory: upload_tmp_dir = C:\php-5.2.10\upload_dir
c.) extension: extension_dir = C:\php-5.2.10\ext
Note: change according to where you extract your php package

3.) Uncomment depending on your needs:
a.) ;extension=php_mysql.dll
b.) ;extension=php_pgsql.dll
c.) ;extension=php_mcrypt.dll
d.) ;extension=php_mbstring.dll

4.) In your environment variable set:
PHPRC = C:\php-5.2.10
How: Right click My Computer->Properties->Advanced->Environment Variables->User Variables->New

5.) Create a new folder where you will put your 3rd party dll needed by the system (libmysql.dll, libmcrypt.dll). In my case: c:\lib\dll.

6.) Move the lib* dll (libmysql.dll, libmcrypt.dll) in c:\lib\dll - the extension that you will used.

7.) Add the c:\lib\dll to your System Variables.
How: Right click My Computer->Properties->Advanced->Environment Variables->System Variables->New

8.) Restart your computer.

Start apache and look in the apacheinstalldir/logs directory

What you might see in error log:

1.) If php issue an error on failed to load mbstring, then there's a problem with your extension directory.

2.) If there's no error about mbstring but on mcrypt and/or mysql then there's a problem with the c:\lib\dll, please make sure that you have added c:\lib\dll to your system path.

0 Comments

Post a Comment

Post a Comment (0)

Previous Post Next Post
NERV Open Source
Building production Spring Boot systems?

Explore NERV — open-source Java libraries for audit trails, persistence, exception handling, and reliable event-driven architecture.