通过命令行模式运行php脚本会发出警告


1

每当我运行我的php命令行脚本时,在脚本实际输出到屏幕之前,php总是会返回一堆错误消息,如下所示:

PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/no-debug-non-zts-20060613/gd.so' - (null) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/no-debug-non-zts-20060613/mbstring.so' - (null) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/no-debug-non-zts-20060613/mcrypt.so' - (null) in Unknown on line 0
PHP Warning:  Module 'memcache' already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/no-debug-non-zts-20060613/mysql.so' - (null) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/no-debug-non-zts-20060613/mysqli.so' - (null) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so' - (null) in Unknown on line 0
PHP Warning:  Module 'syck' already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/no-debug-non-zts-20060613/zip.so' - (null) in Unknown on line 0
PHP Warning:  Module 'xdebug' already loaded in Unknown on line 0

但是,警告似乎并没有阻止我的脚本正常运行(虽然它说某些库无法加载,但我仍然可以在我的脚本中使用它们)。我目前正在通过macports为Leopard 10.5.7运行php5.2

hidetoshi:bin jeffrey04$ port installed php5
The following ports are currently installed:
  php5 @5.2.9_0+apache2+macosx+mysql5+pear+postgresql83
  php5 @5.2.9_2+apache2+macosx+mysql5+pear+postgresql83 (active)
  php5 @5.3.0_1+apache2+macosx+mysql5+pear+postgresql83
  php5 @5.3.0_2+apache2+macosx+mysql5+pear+postgresql83

我通过这个简单的shell脚本切换到php5.2

port deactivate php5 @5.3.0_2+apache2+macosx+mysql5+pear+postgresql83
port activate php5 @5.2.9_2+apache2+macosx+mysql5+pear+postgresql83

port deactivate php5-syck @0.55_2
port activate php5-syck @0.55_1

port deactivate php5-memcache @2.2.5_1
port activate php5-memcache @2.2.5_0

port deactivate php5-xdebug @2.0.5_0
port activate php5-xdebug @2.0.4_0

/opt/local/apache2/bin/apachectl restart

我做错了吗?有没有办法删除php初始化期间返回的警告?


那些图书馆应该在哪里?
random

Answers:


1

我在某处看过类似的问题;建议先进行所有停用, 然后 所有激活,以防某些模块依赖于其他模块。所以将脚本更改为:

port deactivate php5 @5.3.0_2+apache2+macosx+mysql5+pear+postgresql83
port deactivate php5-syck @0.55_2
port deactivate php5-memcache @2.2.5_1
port deactivate php5-xdebug @2.0.5_0

port activate php5 @5.2.9_2+apache2+macosx+mysql5+pear+postgresql83
port activate php5-syck @0.55_1
port activate php5-memcache @2.2.5_0
port activate php5-xdebug @2.0.4_0

/opt/local/apache2/bin/apachectl restart

0

你可能想检查一下php.ini文件的用法,因为在一些基于unix的系统下,php有单独的php.ini文件用于mod_php和cli接口。

如果是这种情况 - 你应该检查cli php.ini文件中的设置。


0

另一个想法 - 停用所有的PHP扩展forst停用php激活php然后激活扩展。

以防万一有其他依赖

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.