LinuxCommandLibrary

php-build

builds PHP versions from source for use with phpenv or standalone

TLDR

List available PHP versions

$ php-build --definitions
copy
Install PHP version
$ php-build [8.2.0] [~/.phpenv/versions/8.2.0]
copy
Install with configure options
$ PHP_BUILD_CONFIGURE_OPTS="--with-openssl" php-build [8.2.0] [/path/to/install]
copy
Install specific version with debug
$ php-build -v [8.2.0] [/path/to/install]
copy

SYNOPSIS

php-build [options] version install-path

DESCRIPTION

php-build builds PHP versions from source for use with phpenv or standalone. It handles downloading, configuring, compiling, and installing multiple PHP versions.

PARAMETERS

--definitions

List available versions.
-v
Verbose mode.
-i file
Read custom definitions.
--pear
Install PEAR.

List versions

php-build --definitions

Install PHP 8.2

php-build 8.2.0 ~/.phpenv/versions/8.2.0

With extensions

PHPBUILDCONFIGURE_OPTS="--with-curl --with-openssl" \
php-build 8.1.0 /opt/php-8.1.0

Install with verbose output

php-build -v 8.2.5 ~/.php/8.2.5

$
# ENVIRONMENT
copy
PHPBUILDCONFIGURE_OPTS # Extra configure options
PHPBUILDEXTRAMAKEARGUMENTS # Extra make arguments
PHPBUILDROOT # Build directory
$
# CAVEATS

Compilation takes time. Requires build dependencies. Used with phpenv for version management.

# HISTORY

php-build is part of the **phpenv** ecosystem, inspired by ruby-build, for managing multiple PHP versions.

# SEE ALSO

phpenv(1), php(1), pecl(1)
copy

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community