linux - mac 下命令行执行 php a.php 报错,php扩展貌似没有加载,怎么加载?
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
回复内容:
【 补充:代码层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.ini,extension_dir设置错误。
/usr/local/Cellar/php54/5.4.33/lib/php/extensions/no-debug-non-zts-20100525/该目录下并没有memcache.so等文件,在其他目录里面
终端 php -i |grep mongo
查看你的扩展是否安装成功。
如果没有 需要下载 扩展并编译安装 安装完成后需要在php.ini中添加模块
可能1:命令行下php.ini没有自动加载,可以手动指定
php -c /etc/php.ini a.php
可能2: 命令行下默认执行的php与web所执行的不一致,查看phpinfo中的php路径,与命令行中的是否一致,不一致的话要改成一致的,或者给两个版本都安装上对于的扩展
which php #看路径
推荐使用brew安装,省去很多麻烦
上一篇: sql如何删除多条数据
下一篇: 查看jdk版本的命令是什么