给宝塔的php fpm添加PHP_INI_SCAN_DIR环境变量

场景

宝塔的php环境和xdebug扩展安装好后,希望xdebug的配置参数独立于php.ini,放置在自定义的路径

步骤

编辑/etc/init.d/php-fpm-74,添加 export PHP_INI_SCAN_DIR=/www/my-conf,这样,在宝塔中重启fpm,会为其添加PHP_INI_SCAN_DIR环境变量,该环境变量的作用是为php添加另外的.ini配置文件加载目录,比如:
xdebug配置文件/www/my-conf/xdebug.ini

xdebug.client_host=host.docker.internal
xdebug.start_with_request=yes
xdebug.mode=debug

2023/11/28 添加cli xdebug调试

"In your CLI run export XDEBUG_TRIGGER=1 && export PHP_IDE_CONFIG="serverName=host.docker.internal" to start xdebug with the request."

1.添加环境变量

export XDEBUG_TRIGGER=1
PHP_IDE_CONFIG="serverName=host.docker.internal"

2. phpstorm 添加server

phpstorm 添加 servers , hosthost.docker.internal. 设置path mapping

posted @ 2021-03-12 22:05  古德爱迪尔  阅读(519)  评论(0编辑  收藏  举报