IT박스

PHP5 오류 .. 동적 라이브러리를로드 할 수 없습니다.

itboxs 2020. 10. 28. 07:53
반응형

PHP5 오류 .. 동적 라이브러리를로드 할 수 없습니다.


root@ip-10-131-9-200:/etc/php5/apache2# php -a
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/curl.so' - /usr/lib/php5/20090626+lfs/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mcrypt.so' - /usr/lib/php5/20090626+lfs/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysql.so' - /usr/lib/php5/20090626+lfs/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysqli.so' - /usr/lib/php5/20090626+lfs/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pdo.so' - /usr/lib/php5/20090626+lfs/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pdo_mysql.so' - /usr/lib/php5/20090626+lfs/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
Interactive shell

몇 가지 다른 답변이 제안하지만 더 많은 불필요한 소프트웨어를 설치하는 것이 일반적으로 최선의 해결책 아닙니다 . 대신 근본적인 문제를 해결해야합니다. 이러한 메시지가 나타나는 이유는 해당 확장을로드하려고하지만 설치되지 않았기 때문입니다. 따라서 쉬운 해결책은 단순히 PHP에게로드 시도를 중지하도록하는 것입니다.

먼저, 위의 확장자를로드하려는 파일을 찾으십시오.

$ grep -Hrv ";" /etc/php5 | grep -E "extension(\s+)?="

Ubuntu의 출력 예 :

/etc/php5/mods-available/gd.ini:extension=gd.so
/etc/php5/mods-available/pdo_sqlite.ini:extension=pdo_sqlite.so
/etc/php5/mods-available/pdo.ini:extension=pdo.so
/etc/php5/mods-available/pdo_mysql.ini:extension=pdo_mysql.so
/etc/php5/mods-available/mysqli.ini:extension=mysqli.so
/etc/php5/mods-available/mysql.ini:extension=mysql.so
/etc/php5/mods-available/curl.ini:extension=curl.so
/etc/php5/mods-available/sqlite3.ini:extension=sqlite3.so
/etc/php5/conf.d/mcrypt.ini:extension=mcrypt.so
/etc/php5/conf.d/imagick.ini:extension=imagick.so
/etc/php5/apache2/php.ini:extension=http.so

이제 오류를 일으키는 확장자를로드하는 파일을 찾고 ;. 어떤 이유로 우분투의 기본 설치로 나에게 이런 일이 발생 했으므로 다른 사람에게 도움이되기를 바랍니다.


sudo apt-get install php5-mcrypt
sudo apt-get install php5-mysql

... 등이 나를 위해 해결했습니다. :)

도움이되기를 바랍니다


/etc/php5/cli/conf.d/를 찾아 해당 * .ini 파일을 삭제하십시오. 이 오류는 일부 php 패키지를 깨끗하게 제거 할 때 발생합니다.


PHP 를 최신 버전으로 업그레이드 하고 이전 .ini 파일이 여전히 이전 위치를 가리키는 것 같습니다 .

해결책 : 지금 모듈이 어디에 있는지 알아 내십시오

ls -l /usr/lib/php5

old와 유사한 디렉토리가 있어야합니다 20090626. 제 경우에는 지금입니다20131226

오류를 제공하는 .ini 파일은 다음 위치에 있습니다. /etc/php5/cli/conf.d/

모듈이 오류를 제공하는 .ini 파일을 편집하십시오. 예를 들어, mcrypt 모듈에 대한 오류 인 경우 :

sudo vi /etc/php5/cli/conf.d/20-mcrypt.ini

라인 변경 :

extension=/usr/lib/php5/20090626/mcrypt.so

.so 파일의 새 경로를 반영합니다. 제 경우 올바른 경로는 다음과 같습니다.

extension=/usr/lib/php5/20131226/mcrypt.so

그게 다야! 오류가 사라졌습니다. Ofc 당신은 오류를 제공하는 각 모듈에서 그것을 수행해야합니다.


당신이 넣으면; 이 작업은 확장을 비활성화합니다.

나는 같은 문제가 있었고 다음을 수행했습니다.

  1. 제거 매개 변수를 사용하여 PHP를 제거합니다.

    sudo apt-get --purge remove php5-common
    
  2. 그리고 다시 설치하십시오.

    sudo apt-get install php5 php5-mysql
    

내 문제는 다음 명령으로 해결되었습니다.

sudo apt-get install php5-mcrypt

나는 가지고있다

  • PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli)
  • Ubuntu 데스크탑 12.04
  • MySQL 5.5

이 솔루션은 blog.tordeu.com 에서 찾았 습니다.

sudo aptitude purge php5-suhosin

확실 suhosin하지 않지만 더 이상 필요하지 않은 것 같습니다 . 내 PHP 버전에서 작동했습니다.

PHP 5.4.34-1+deb.sury.org~lucid+1 (cli) (built: Oct 17 2014 15:26:51)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

5.6 php를 사용하는 경우

sudo apt-get install php5.6-curl


어떻게 든 gmp.so파일이 내 시스템에서 삭제 된 것 같습니다. 이것이 나를 위해 고친 것입니다.

sudo apt-get install --reinstall php5-gmp


우분투 14.04의 경우 mcrypt에만 해당 오류가 발생했습니다.

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

If you have a closer look at the error, php is looking for mcrypt.ini and not for mcrypt.so at that location. I just copy mcrypt.so to mcrypt.ini and that's it, the warning is gone and the extension now is properly installed. It might look a bit dirty but it worked!


I had enabled the extension_dir in php.ini by uncommenting,

  extension_dir = "ext"
  extension=phpchartdir550.dll

and copying phpchartdir550 dll to the extension_dir (/usr/lib/php5/20121212), resulted in the same error.

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

As @Mike pointed out, it is not necessary to install all the stuff when they are not actually required in the application.

The easier way is to provide the full path to the extensions to be loaded after copying the libraries to the correct location.

Copy phpchartdir550.dll to /usr/lib/php5/20121212, which is the extension_dir in my Ubuntu 14.04 (this can be seen using phpinfo()) and then provide full path to the library in php.ini,

;   extension=/path/to/extension/msql.so
extension=/usr/lib/php5/20121212/phpchartdir550.dll

restart apache: sudo service apache2 restart

even though other .so's are present in the same directory, only the required ones can be selectively loaded.


I had a similar problem, which led me here:

$ phpunit --version
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/profiler.so' - /usr/lib/php5/20131226/profiler.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.

Unlike the above, installing the software did not resolve my problem because I already had it.

$ sudo apt-get install php5-uprofiler
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php5-uprofiler is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.

I found my solution via : Debian Bug report logs

$ sudo vim /etc/php5/mods-available/uprofiler.ini

I edited the ini file, changing extension=profiler.so to extension=uprofiler.so .... the result, happily:

$ phpunit --version
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.

i.e. no more warning.


(For Ubuntu users)

I had the same problem, but none of the answers above solved that. Here is how I solved the problem.

Open your php.ini file (mine was in /etc/php/7.3/cli/php.ini).

You may have something like this:

extension=pdo_mysql

Or maybe:

extension=/here/is/the/path/to/your/file/pdo_mysql.so

Add the following line before extension=pdo_mysql

extension=pdo

So, you will have:

extension=pdo
extension=pdo_mysql

It seems that the problem is (at least in my case) that we need to load pdo extension first to load the pdo_mysql extension.

Hope that helps!


Try this:

  • Open php.ini
  • Path: etc/php5/cli/php.ini
  • Remove or comment: extension=ssh2.so then save it.

참고URL : https://stackoverflow.com/questions/10565521/error-in-php5-unable-to-load-dynamic-library

반응형