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

original piece http://www.somacon.com/p520.php

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/"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值