Coder Social home page Coder Social logo

make-php's Introduction

make-php

A simple script to build different PHP versions for development. It uses the debian alternatives system to replace the system-wide PHP binaries and allows resetting to defaults if the PHP binaries installed via the package manager should be used.

Installation

Dependencies

At least the following packages are needed to run this:

apt-get install  build-essential autoconf automake

A more complete set of build tools:

apt-get install  build-essential autoconf automake git curl pkg-config bison re2c libxml2-dev

You may also need these for some build options of PHP:

apt-get install  libicu-dev libmcrypt-dev libreadline-dev libxml2-dev libbz2-dev \
                 openssl libssl-dev libcurl4-openssl-dev libjpeg-dev libpng-dev \
                 libfreetype6-dev libmm-dev libpq-dev

Clone Repo

After installing dependencies you can clone this repository. The location does not matter, but I use to put it under /srv/php-src:

git clone https://github.com/cebe/make-php /srv/php-src

You may want to adjust the BUILD_TARGET in the script. By default PHP binaries are installed to /srv/php.

GPG

The script will check the signatures of the PHP tar files it downloads, so you need to add the keys of the PHP maintainers to you GPG trust DB. You can do it manually, or use the make-php-keyring.sh script:

./make-php-keyring.sh

Usage

Building a PHP binary

Create a *.conf file for each build config. If you want to statically link pecl extensions into the binary you may list the names of the extensions in *.pecl.conf. See example.conf and example.pecl.conf for examples.

Run the script (assuming your config is myconfig.conf):

./make-php.sh myconfig 7.0.12

Afterwards you can use the switch-php.sh command to replace the existing /usr/bin/php* symlinks using debians update-alternatives system. ./switch-php.sh --reset will restore the original PHP version that may be installed by apt.

Tip: To enable the switch-php command, you can link it to /usr/local/bin: ln -s /srv/php-src/switch-php.sh /usr/local/bin/switch-php

Builing alpha/beta releases

If you want to install PHP versions that are not officially released or pre-releases like alpha versions, you can specify a URL for the file to download. E.g. to install PHP 7.2.0alpha3 use the following command:

./make-php.sh myconfig 7.2.0alpha3 https://downloads.php.net/~remi/php-7.2.0alpha3.tar.bz2 https://downloads.php.net/~remi/php-7.2.0alpha3.tar.bz2.asc

Applying patches

If you want to apply patches to the PHP source code, e.g. to fix some bugs or apply workarounds in your specific version, you can place a .patch file in the patches/php-$VERSION directory. All patch files found in that directory will be applied before building PHP.

E.g. to apply the fix for finding cURL on debian on PHP 7.1.8, you can create a file containing the patch in patches/php-7.1.8/curlfix.patch.

make-php's People

Contributors

cebe avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

make-php's Issues

update switchphp to work more natively

update switchphp to register all alternatives and then select the one you wanted, setting
back to auto mode when calling it with --reset. An additional switch should be added to uninstall all alternatives.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.