doutang1946 2014-07-30 07:51
浏览 658
已采纳

检索PHP --with-config-file-scan-dir开关的值

I need to return the path of folder configured via the --with-config-file-scan-dir switch for a particular PHP implementation.

I can achieve this by writing bash code something like:

folder=$(php --ini                                         \
        | grep "Scan for additional .ini files in:"        \
        | cut -d" " -f7       \
        )

But the above approach seems inexact and potentially error prone.

My preference would be to do something like the following:

folder=$(php -r 'print ini_get("with-config-file-scan-dir config option");')

but I can't seem to find the necessary configuration option name.

I would greatly appreciate some guru input on this if you have it!

thanks in advance

  • 写回答

3条回答 默认 最新

  • duan4523 2019-05-13 23:58
    关注

    You can use PHP_CONFIG_FILE_SCAN_DIR.

    php -r "echo PHP_CONFIG_FILE_SCAN_DIR;"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部