如何从 PHP 获取 PHP 二进制文件的路径? [英] How can I get the path of the PHP binary from PHP?

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

问题描述

如何从PHP获取php的二进制路径?

How can I get the binary path of php from PHP?

我在 phpinfo() 中看到了它,但我需要在 Linux 和 Windows 系统中获取它的另一种方法.

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.

CodePadIdeone.

看起来,出于安全原因,$_SERVER 值没有公开.

It looks like, for security reasons, $_SERVER values are not exposed.

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

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