1. 程式人生 > >php報錯:PHP Startup Unable to load dynamic library

php報錯:PHP Startup Unable to load dynamic library

今天遇到使用php命令執行檔案報錯,提示:PHP Startup: Unable to load dynamic ,於是網上找了好多資料,終於解決,記錄如下,以便日後查閱。

報錯內容如下:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/redis.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/redis.so: undefined symbol: zend_ce_exception in
Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/memcached.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/memcached.so: undefined symbol: zend_hash_str_del in Unknown on line 0 PHP Warning: PHP Startup: Unable to load
dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/swoole.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/swoole.so: undefined symbol: zend_hash_str_del in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/curl.so'
- /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/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/local/php/lib/php/extensions/no-debug-non-zts-20160303/dom.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/dom.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/fileinfo.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/fileinfo.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/json.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/json.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/phar.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/phar.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/posix.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/posix.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/sysvmsg.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/sysvmsg.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/sysvsem.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/sysvsem.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/sysvshm.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/sysvshm.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/wddx.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/wddx.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/xmlreader.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/xmlreader.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/xmlwriter.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/xmlwriter.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/xsl.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/xsl.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/local/php/lib/php/extensions/no-debug-non-zts-20160303/zip.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/zip.so: cannot open shared object file: No such file or directory in Unknown on line 0

解決方法:
將/etc/php.d/目錄下的.ini檔案全部重新命名為.so檔案

如:cp /etc/php.d/zip.ini /etc/php.d/zip.so

按照以上方法處理完之後,還是有三個警告:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/redis.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/redis.so: undefined symbol: zend_ce_exception in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/memcached.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/memcached.so: undefined symbol: zend_hash_str_del in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/swoole.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/swoole.so: undefined symbol: zend_hash_str_del in Unknown on line 0

原來是這三個擴充套件被重複載入了,開啟php.ini檔案,註釋擴充套件載入的地方即可

vi /etc/php.ini # 將redis、memcache、swoo載入的地方註釋即可
/etc/init.d/php-fpm restart