Skip to content

Requirement

Muhammad Nur'Ihsan Bin Berahim edited this page Jan 26, 2021 · 67 revisions

These requirements are for you to run phpbrew and build your PHP. To build your PHP, you need a lot of libraries installed on your system.

The instructions below help you to get things done. Please note that this document may not apply to the versions still under development, and you may need to install some libraries which are not listed here for certain extensions.

Platform support

  • Mac OS 10.5+
  • Ubuntu
  • Debian
  • RHEL / CentOS

Dependencies

  • PHP5.3+
  • bz2
  • curl
  • gcc, binutils, autoconf, libxml, zlib, readline

Mac OS X Requirement

HomeBrew

xcode-select --install
brew install autoconf pkg-config

Ubuntu Requirements

The following requirements will satisfy the +neutral variant.

Ubuntu 18.04

apt-get install \
  build-essential \
  libbz2-dev \
  libreadline-dev \
  libsqlite3-dev \
  libcurl4-gnutls-dev \
  libzip-dev \
  libssl-dev \
  libxml2-dev \
  libxslt-dev \
  php7.2-cli \
  php7.2-bz2 \
  pkg-config

Notes:

  1. build-essential provides the toolchain needed for building PHP and extensions from the source.
  2. libbz2-dev is required for PHPBrew to be able to unpack PHP distribution archives.
  3. libsqlite3-dev is required since the SQLite3 extension is enabled by default since PHP 5.3.
  4. libssl-dev is required for PHPBrew to be able to download PHP distribution archives over HTTPS.
  5. libxml2-dev and libxslt-dev are required for PHPBrew to be able to parse PEAR package definitions in XML.
  6. pkg-config is required for the PHP build scripts to discover installed build dependencies.

Ubuntu 16.04

apt-get install \
  build-essential \
  libbz2-dev \
  libreadline-dev \
  libsqlite3-dev \
  libssl-dev \
  libxml2-dev \
  libxslt1-dev \
  php7.0-cli \
  php7.0-bz2 \
  pkg-config

Ubuntu 14.04 and older

Please note that you need to disable the Suhosin patch to run PHPBrew.

apt-get install \
  build-essential \
  libbz2-dev \
  libreadline-dev \
  libsqlite3-dev \
  libssl-dev \
  libxml2-dev \
  libxslt1-dev \
  php5-cli \
  php5-bz2 \
  pkg-config

Debian

The following is the minimum requirements for phpbrew to be able to build php versions with the +default variant. As an extra bonus, the command below doesn't install apache2, which is a dependency for php in Debian! It has been tested with Debian Bullseye (testing as of 2020).

sudo apt install php7.3 php7.3-common php7.3-cli php7.3-fpm build-essential autoconf automake autotools-dev re2c libxml2 libxml2-dev libssl-dev openssl gettext libicu-dev libmcrypt-dev libmcrypt4 libmhash-dev libmhash2 libfreetype6 libfreetype6-dev libgd-dev libgd3 libpng-dev libpng16-16 libjpeg-dev libxpm4 libltdl7 libltdl-dev libreadline-dev php7.3-bz2 libbz2-dev libcurl4-gnutls-dev libzip-dev

Fedora/CentOS Requirements

yum install make gcc gcc-c++ kernel-devel # these are equivalent to Debian's "build-essential"
yum install php php-bz2 php-devel php-pear bzip2-devel yum-utils libmcrypt-devel libpqxx-devel libxslt-devel pcre-devel libcurl-devel libgsasl-devel openldap-devel
yum-builddep php

To compile with +apxs2

yum install httpd-devel

CentOS Requirement

Please note that you need to disable suhosin patch to run phpbrew.

CentOS package requirements are the same as Fedora

# CentOS/RHEL 7.x:
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

# CentOS/RHEL 6.x:
sudo rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

# If you don't have php
sudo yum install --enablerepo=webtatic php php-bz2 php-xml
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
sudo rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
sudo yum install --enablerepo=rpmforge libmhash

Reference: http://matome.naver.jp/odai/2133887830324055901

openSUSE Tumbleweed

Before you start phpbrew installation:

sudo zypper in php7 php7-bz2 php7-phar php7-curl php7-openssl

For default and fpm variant installation:

sudo zypper in -t pattern devel_basis 
sudo zypper in libxml2-devel libopenssl-devel libbz2-devel libmcrypt-devel libxslt-devel

To install

phpbrew install 7.0 +default +fpm -- --with-libdir=lib64

Building development versions of PHP

In order to be able to build PHP from an arbitrary source tree (e.g. from a git branch), an additional set of dependencies is needed.

HomeBrew

brew install bison re2c

Ubuntu

apt-get install bison re2c

Fedora/CentOS

yum install bison re2c

Manjaro

[Community Contributed wiki entry]

  • Install php7.4+ , pkg-config
  • Enable bz2 extension by un-commenting relevant entry /etc/php/php.ini file