docker安装php插件
- 直接上代码
- PHPStorm调试
- 常见问题
-
- 如果查看系统类型
- 如何查看xdebug合适的版本
- 安装异常提示
-
- Cannot find autoconf. Please check your autoconf installation and the$PHP_AUTOCONF environment variable. Then, rerun this script.
- configure: error: in `/tmp/pear/temp/pear-build-defaultuserJliooe/xdebug-3.1.6′: configure: error: C compiler cannot create executables
- sh: make: not found
- pecl/xdebug requires PHP (version >= 8.0.0, version <= 8.2.99), installed version is 7.4.27
直接上代码
基于Alpine系统
- 进入容器
- 安装xdebug
pecl install xdebug-3.2.1
docker-php-ext-enable xdebug
上述代码基于官方说明:
PHPStorm调试
Xdebug2 和 Xdebug3 的配置不一样,并且Xdebug3并不兼容Xdebug2的编写方式
具体文章可以参考:https://www.xiebruce.top/1191.html#xdebug
======== 安装成功的人,安装xdebug,可以到此结束,记得重启PHP进程 ============
======== 不成功的可以跳转到常见问题 ============
常见问题
如果查看系统类型
cat /etc/os-release
如何查看xdebug合适的版本
进入xdebug官网贴上你的phpinfo里面的内容
安装异常提示
Cannot find autoconf. Please check your autoconf installation and the$PHP_AUTOCONF environment variable. Then, rerun this script.
表示你的环境缺少 autoconf
,autoconf 是一个用于创建能自动配置源代码包的 shell 脚本的工具。
apk add autoconf
configure: error: in `/tmp/pear/temp/pear-build-defaultuserJliooe/xdebug-3.1.6’: configure: error: C compiler cannot create executables
表示你的Alpine Linux可能缺少gcc和g++。
apk add gcc g++
sh: make: not found
apk add make
pecl/xdebug requires PHP (version >= 8.0.0, version <= 8.2.99), installed version is 7.4.27
xdebug的版本不对,修改版本信息,例如:PHP7的版本,可以试试下面的xdebug版本
pecl install xdebug-3.1.6
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/181698.html