PHP Warning: Module 'modulename' already loaded in Unknown on line 0

This page describes how to resolve the following PHP warning: PHP Warning: Module 'modulename' already loaded in Unknown on line 0

Problem

When running the CLI version of PHP from the command line, you may receive errors like the following:

[root@myserver /root]$ php -v 
PHP Warning: Module 'pcre' already loaded in Unknown on line 0 
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/spl.so' - /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/spl.so: Undefined symbol "pcre_exec" in Unknown on line 0 
PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0 
PHP Warning: Module 'session' already loaded in Unknown on line 0 
PHP Warning: Module 'exif' already loaded in Unknown on line 0 
PHP 5.2.3 (cli) (built: Jun 14 2007 15:29:17) 
Copyright (c) 1997-2007 The PHP Group 
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

Cause

There are two ways to load most extensions in PHP. One is by compiling the extension directly into the PHP binary. The other is by loading a shared extension dynamically via an ini file. The errors indicate that dynamic extensions are being loaded via .ini files, even though they are already compiled into the PHP binary.

Fix

To fix this problem, you must edit your php.ini (or extensions.ini) file and comment-out the extensions that are already compiled-in. For example, after editing, your ini file may look like the lines below:

;extension=pcre.so
;extension=spl.so
;extension=simplexml.so
;extension=session.so
;extension=exif.so

You may also erase those lines instead of commenting them out. Once you have disabled those lines, run php -v to see if the warnings go away.

Additional Info

To see which extensions are compiled-in to your PHP binary, run the following command:

php -m

You can also view the configure command, which will show which extensions are enabled and compiled-in, or built as shared, dynamic modules.

php -i | grep Configure

The dynamic extensions are usually located in a special "extensions" folder, which varies by operating system environment. Your php.ini usually has a line that describes where the folder is located. For example:

; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/"


转自:http://www.somacon.com/p520.php

[root@yfw ~]# cd /www/wwwroot/szrengjing.com/chat [root@yfw chat]# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" PHP: syntax error, unexpected '(' in /www/server/php/56/etc/php-cli.ini on line 883 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.dll' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.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 '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.so' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.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 '/path/to/extension/msql.so' - /path/to/extension/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in Command line code on line 1 Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in Command line code on line 1 PHP Warning: copy(): Failed to enable crypto in Command line code on line 1 Warning: copy(): Failed to enable crypto in Command line code on line 1 PHP Warning: copy(https://getcomposer.org/installer): failed to open stream: operation failed in Command line code on line 1 Warning: copy(https://getcomposer.org/installer): failed to open stream: operation failed in Command line code on line 1 [root@yfw chat]# php composer-setup.php PHP: syntax error, unexpected '(' in /www/server/php/56/etc/php-cli.ini on line 883 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.dll' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.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 '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.so' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.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 '/path/to/extension/msql.so' - /path/to/extension/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0 Could not open input file: composer-setup.php [root@yfw chat]# php composer.phar require ratchet/ratchet:0.3.6 PHP: syntax error, unexpected '(' in /www/server/php/56/etc/php-cli.ini on line 883 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.dll' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.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 '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.so' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.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 '/path/to/extension/msql.so' - /path/to/extension/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0 Could not open input file: composer.phar [root@yfw chat]# 报错了吧
最新发布
07-16
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值