swoole / swoole-src

🚀 Coroutine-based concurrency library for PHP
https://www.swoole.com
Apache License 2.0
18.47k stars 3.16k forks source link

Unable to load dynamic library 'swoole.so' #2550

Closed chhaunkar96 closed 5 years ago

chhaunkar96 commented 5 years ago

About PHP PHP 7.2.16-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:23:06) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.16-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

OS: Mint linux

ERROR: PHP Warning: PHP Startup: Unable to load dynamic library 'swoole.so' (tried: /usr/lib/php/20170718/swoole.so (/usr/lib/php/20170718/swoole.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/swoole.so.so (/usr/lib/php/20170718/swoole.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

matyhtf commented 5 years ago

You need to compile and install first.

chhaunkar96 commented 5 years ago

I have installed with pecl. pecl install swoole

I really need to compile.

matyhtf commented 5 years ago

Which php-config is used?

which php
which php-config
php-config

Does your system have multiple php?

chhaunkar96 commented 5 years ago

which php /usr/bin/php which php-config /usr/bin/php-config php-config

Usage: /usr/bin/php-config [OPTION]
Options:
  --prefix            [/usr]
  --includes          [-I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib ]
  --ldflags           [-L/usr/lib/php/20151012  -L/usr/lib/x86_64-linux-gnu]
  --libs              [-lcrypt   -lresolv -lcrypt -lz -lpcre -lrt -lm -ldl -lnsl  -lxml2 -lssl -lcrypto -lcrypt -lcrypt ]
  --extension-dir     [/usr/lib/php/20151012]
  --include-dir       [/usr/include/php/20151012]
  --man-dir           [/usr/share/man]
  --php-binary        [/usr/bin/php7.0]
  --php-sapis         [apache2handler cgi cli fpm phpdbg ]
  --phpapi            [20151012]
  --configure-options [--includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --disable-silent-rules --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-cli --disable-cgi --disable-phpdbg --with-config-file-path=/etc/php/7.0/cli --with-config-file-scan-dir=/etc/php/7.0/cli/conf.d --build=x86_64-linux-gnu --host=x86_64-linux-gnu --config-cache --cache-file=/build/php7.0-Ts_EGl/php7.0-7.0.33/config.cache --libdir=${prefix}/lib/php --libexecdir=${prefix}/lib/php --datadir=${prefix}/share/php/7.0 --program-suffix=7.0 --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-all --disable-debug --disable-rpath --disable-static --with-pic --with-layout=GNU --without-pear --enable-filter --with-openssl=yes --with-pcre-regex=/usr --enable-hash --with-mhash=/usr --enable-libxml --enable-session --with-system-tzdata --with-zlib=/usr --with-zlib-dir=/usr --enable-dtrace --enable-pcntl --with-libedit=shared,/usr build_alias=x86_64-linux-gnu host_alias=x86_64-linux-gnu CFLAGS=-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -O2 -Wall -pedantic -fsigned-char -fno-strict-aliasing -g]
  --version           [7.0.33-5+ubuntu16.04.1+deb.sury.org+1]
  --vernum            [70033]

Does your system have multiple php? yes 7.0 7.1 7.2 7.3 Current version: `PHP 7.2.16-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:23:06) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.16-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

chenyongze commented 5 years ago

/var/www/html # php -m|grep swoole PHP Warning: PHP Startup: Unable to load dynamic library 'swoole.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/swoole.so (Error loading shared library libstdc++.so.6: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20180731/swoole.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/swoole.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20180731/swoole.so.so: No such file or directory)) in Unknown on line 0

chenyongze commented 5 years ago

/usr/local/lib/php/extensions/no-debug-non-zts-20180731/swoole.so.so

twose commented 5 years ago

I noticed that you've changed your PHP version again try it again:

which php
php -v
which php-config
php-config

and it requires gcc > 4.8

BigFlu commented 5 years ago

echo "extension=swoole">$YOURPATHTO/php.d/swoole.ini

advcha commented 5 years ago

I got the same problem. here is my way to solve it. If you change your default php version, for example to php7.2, make sure you also install php7.2-dev package sudo apt install php7.2-dev run php-config to make sure it point to php7.2 version not php7.0

before run sudo pecl install swoole, check the php extension-dir not have swoole.so file (for example your php7.2 extension-dir in /usr/lib/php/20170718). so if any swoole.so file in it, remove it manually). the rest installation steps should be straight forward and the error should be gone.

ibrahimkh94 commented 1 year ago

echo "extension=swoole">$YOURPATHTO/php.d/swoole.ini

Could you please sir @BigFlu show in details where to put this line

ibrahimkh94 commented 1 year ago

Hi @matyhtf , could you please help me sir, i have the same probelm and i have multiversion of php with the same OS

PHP Warning: PHP Startup: Unable to load dynamic library 'openswoole' (tried: /usr/lib/php/20210902/openswoole (/usr/lib/php/20210902/openswoole: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/openswoole.so (/usr/lib/php/20210902/openswoole.so: undefined symbol: socket_ce)) in Unknown on line 0

NathanFreeman commented 1 year ago

@ibrahimkh94 you need to compile php_socket extension first;