如何从PHP获取PHP BIN的路径? [英] How to get the path of the PHP BIN from PHP?

查看:106
本文介绍了如何从PHP获取PHP BIN的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从PHP获取php的bin路径?我在phpinfo()中看到了它;但是我需要在Linux和Windows系统中获得它的另一种方法.

How can I get the bin path of php from PHP? I saw it in phpinfo(); but I need another method that gets it in linux and windows systems.

推荐答案

您可以使用:

$_SERVER['_']

此外,预定义常量PHP_BINDIR 给出找到php可执行文件的目录.

Also, the predefined constant PHP_BINDIR gives the directory where the php executable is found.

键盘上的示例 ideone .

出于安全原因,$_SERVER值似乎未公开. (我想.如果我错了,请纠正我).

Looks like, for security reasons, $_SERVER values are not exposed. (I guess. Please correct me if I'm wrong).

这篇关于如何从PHP获取PHP BIN的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆