search

Home  >  Q&A  >  body text

linux - mac 下命令行执行 php a.php 报错,php扩展貌似没有加载,怎么加载?

【 补充:代码层phpinfo(),扩展信息均正常显示】

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/mongo.so' - dlopen(/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/mongo.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/mongo.so' - dlopen(/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/mongo.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/memcache.so' - dlopen(/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/memcache.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/memcache.so' - dlopen(/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/memcache.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/redis.so' - dlopen(/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/redis.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/redis.so' - dlopen(/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/redis.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/zmq.so' - dlopen(/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/zmq.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/zmq.so' - dlopen(/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/zmq.so, 9): image not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/msgpack.so' - dlopen(/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/msgpack.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/msgpack.so' - dlopen(/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/msgpack.so, 9): image not found in Unknown on line 0

PHP中文网PHP中文网2818 days ago455

reply all(4)I'll reply

  • PHP中文网

    PHP中文网2017-04-10 15:07:01

    配置文件php.ini,extension_dir设置错误。
    /usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/该目录下并没有memcache.so等文件,在其他目录里面

    reply
    0
  • 高洛峰

    高洛峰2017-04-10 15:07:01

    终端 php -i |grep mongo查看你的扩展是否安装成功。
    如果没有 需要下载 扩展并编译安装 安装完成后需要在php.ini中添加模块

    reply
    0
  • 阿神

    阿神2017-04-10 15:07:01

    可能1:命令行下php.ini没有自动加载,可以手动指定

    php  -c  /etc/php.ini a.php
    

    可能2: 命令行下默认执行的php与web所执行的不一致,查看phpinfo中的php路径,与命令行中的是否一致,不一致的话要改成一致的,或者给两个版本都安装上对于的扩展

    which php #看路径
    

    reply
    0
  • PHPz

    PHPz2017-04-10 15:07:01

    推荐使用brew安装,省去很多麻烦

    reply
    0
  • Cancelreply