Title: WP_CLI::get_php_binary()
Published: June 12, 2025
Last modified: July 21, 2026

---

# WP_CLI::get_php_binary()

## In this article

 * [Usage](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-get-php-binary/?output_format=md#usage)
 * [Notes](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-get-php-binary/?output_format=md#notes)
 * [Related](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-get-php-binary/?output_format=md#related)

[↑ Back to top](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-get-php-binary/?output_format=md#wp--skip-link--target)

Get the path to the PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor)
is a widely-used open source general-purpose scripting language that is especially
suited for web development and can be embedded into HTML. [https://www.php.net/manual/en/index.php](https://www.php.net/manual/en/index.php)
binary used when executing WP-CLIWP-CLI WP-CLI is the Command Line Interface for
WordPress, used to do administrative and development tasks in a programmatic way.
The project page is [http://wp-cli.org/](http://wp-cli.org/) [https://make.wordpress.org/cli/](https://make.wordpress.org/cli/).

---

## 󠀁[Usage](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-get-php-binary/?output_format=md#usage)󠁿

    ```
    WP_CLI::get_php_binary()
    ```

 **@return** (string)

---

## 󠀁[Notes](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-get-php-binary/?output_format=md#notes)󠁿

Environment values permit specific binaries to be indicated.

Note: moved to Utils, left for BC.

_Internal APIAPI An API or Application Programming Interface is a software intermediary
that allows programs to interact with each other and share data in limited, clearly
defined ways. documentation is generated from the WP-CLI codebase on every release.
To suggest improvements, please submit a pull request._

---

## 󠀁[Related](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-get-php-binary/?output_format=md#related)󠁿

 * **[WP_CLI\Utils\get_home_dir()](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-utils-get-home-dir/)**–
   Get the home directory.
 * **[WP_CLI\Utils\trailingslashit()](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-utils-trailingslashit/)**–
   Appends a trailing slash.
 * **[WP_CLI\Utils\normalize_path()](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-utils-normalize-path/)**–
   Normalize a filesystem path.
 * **[WP_CLI\Utils\get_temp_dir()](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-utils-get-temp-dir/)**–
   Get the system’s temp directory. Warns user if it isn’t writable.
 * **[WP_CLI\Utils\get_php_binary()](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-utils-get-php-binary/)**–
   Get the path to the PHP binary used when executing WP-CLI.

First published

June 12, 2025

Last updated

July 21, 2026

Edit article

[ Improve it on GitHub: [article_title] ](https://github.com/wp-cli/handbook/edit/main/internal-api/wp-cli-get-php-binary.md)

Changelog

[ See list of changes: [article_title] ](https://github.com/wp-cli/handbook/commits/main/internal-api/wp-cli-get-php-binary.md)

[  Previous: WP_CLI::get_config()](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-get-config/)

[  Next: WP_CLI::halt()](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-halt/)