function ProcessFactory::getPhpDirectory

Returns the directory which contains the PHP interpreter.

Return value

string The path of the directory containing the PHP interpreter. If the server is running in a command-line interface, the directory portion of PHP_BINARY is returned; otherwise, the compile-time PHP_BINDIR is.

See also

php_sapi_name()

https://www.php.net/manual/en/reserved.constants.php

File

core/modules/package_manager/src/ProcessFactory.php, line 59

Class

ProcessFactory
Defines a process factory which sets the COMPOSER_HOME environment variable.

Namespace

Drupal\package_manager

Code

private static function getPhpDirectory() : string {
    if (PHP_SAPI === 'cli' || PHP_SAPI === 'cli-server') {
        return dirname(PHP_BINARY);
    }
    return PHP_BINDIR;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.