Build PHP 5.6 and newer
MIT License
Ubuntu
and Debian
.All other distributions based on the above operating systems will also be supported on best effort basis.
curl -sSLO https://github.com/shivammathur/php-builder/releases/latest/download/install.sh
chmod a+x ./install.sh
The installer takes the following options:
./install.sh <php-version> <release|debug> <nts|zts>
The php-version
is required, and release
and nts
are the defaults.
PHP 8.3
without debugging symbols and non thread safe:./install.sh 8.3
PHP 8.3
with debugging symbols and thread safe:./install.sh 8.3 debug zts
php -v
Notes:
/usr
and the directory structure will be same as that of the official Debian builds.amqp
, apcu
, ast
, bcmath
, bz2
, calendar
, Core
, ctype
, curl
, date
, dba
, dom
, ds
, enchant
, exif
, FFI
, fileinfo
, filter
, ftp
, gd
, gettext
, gmp
, hash
, iconv
, igbinary
, imagick
, imap
, intl
, json
, ldap
, libxml
, mbstring
, memcache
, memcached
, mongodb
, msgpack
, mysqli
, mysqlnd
, odbc
, openssl
, pcntl
, pcov
, pcre
, PDO
, pdo_dblib
, PDO_Firebird
, pdo_mysql
, PDO_ODBC
, pdo_pgsql
, pdo_sqlite
, pdo_sqlsrv
, pgsql
, Phar
, posix
, pspell
, readline
, redis
, Reflection
, session
, shmop
, SimpleXML
, soap
, sockets
, sodium
, SPL
, sqlite3
, sqlsrv
, standard
, sysvmsg
, sysvsem
, sysvshm
, tidy
, tokenizer
, xdebug
, xml
, xmlreader
, xmlwriter
, xsl
, zip
, zlib
, Xdebug
, Zend OPcache
Extension PCOV is disabled by default as Xdebug is enabled.
You can switch to PCOV by disabling Xdebug using phpdismod
and enabling it using phpenmod
.
phpdismod -v <ALL|php-version> -s <ALL|sapi-name> xdebug
phpenmod -v <ALL|php-version> -s <ALL|sapi-name> pcov
More extensions can also be installed from ppa:ondrej/php
PECL
is also installed along with PHP, so compatible extensions can also be installed using it. These will be enabled using the pecl.ini
module which is linked to all SAPIs.
pecl install <extension>
PHP 8.0 and above versions have a JIT(Just-In-Time) compiler.
It is disabled by default, and can be enabled by the following steps:
phpdismod -v <ALL|php-version> -s <ALL|sapi-name> xdebug pcov
switch_jit
script for the same PHP versions and SAPIs.switch_jit -v <ALL|php-version> -s <ALL|sapi-name> enable -m <jit_mode> -b <jit_buffer_size>
If you do not specify -m
or -b
, the default for JIT mode is tracing
, and for JIT buffer size it is 128M
.
To disable JIT:
switch_jit -v <php-version> -s <ALL|sapi-name> disable
These SAPIs are installed by default:
apache2-handler
cli
cgi
embed
fpm
phpdbg
These SAPI:server configurations can be set up with the switch_sapi
script:
apache:apache
(apache2-handler with Apache)fpm:apache
(php-fpm with Apache)cgi:apache
(php-cgi with Apache)fpm:nginx
(php-fpm with Nginx)switch_sapi -v <php-version> -s <sapi|sapi:server>
Note: When you run switch_sapi
, the servers will have the default document root /var/www/html
.
The following releases have nts
and zts
builds for the following PHP versions along with builds with and without debugging symbols.
curl -sSLO https://github.com/shivammathur/php-builder/releases/latest/download/install.sh
chmod a+x ./install.sh
PHP 8.3
:./install.sh --remove 8.3
or, to remove PHP 8.2
:
./install.sh --remove 8.2
The scripts and documentation in this project are under the MIT license. This project has multiple dependencies. Their licenses can be found in their respective repositories.