├── README.md ├── centos7.1 ├── .gitignore ├── Vagrantfile └── build-php7.sh └── ubuntu15.04 ├── .gitignore ├── Vagrantfile └── build-php7.sh /README.md: -------------------------------------------------------------------------------- 1 | # Vagrantfiles for building PHP7 2 | 3 | Build PHP7 on CentOS or Ubuntu from [php-src](https://github.com/php/php-src) 4 | 5 | ## for CentOS user 6 | 7 | ``` 8 | cd centos7.1 9 | vagrant up 10 | ``` 11 | 12 | ## for Ubuntu user 13 | 14 | ``` 15 | cd ubuntu15.04 16 | vagrant up 17 | ``` 18 | -------------------------------------------------------------------------------- /centos7.1/.gitignore: -------------------------------------------------------------------------------- 1 | /.vagrant/ 2 | -------------------------------------------------------------------------------- /centos7.1/Vagrantfile: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | # -*- mode: ruby -*- 3 | 4 | Vagrant.configure(2) do |config| 5 | config.vm.box = "bento/centos-7.1" 6 | 7 | config.vm.network "private_network", ip: "10.20.30.50" 8 | config.vm.provider "virtualbox" do |vb| 9 | vb.memory = "2048" 10 | end 11 | 12 | config.vm.provision "shell", path: "./build-php7.sh" 13 | end 14 | -------------------------------------------------------------------------------- /centos7.1/build-php7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export LC_ALL=C 6 | export PHP_VER=7.0.1 7 | export PHP_PREFIX=/opt/php 8 | 9 | sudo yum -y update 10 | sudo yum -y install epel-release 11 | sudo yum -y install tar make gcc autoconf bison re2c 12 | 13 | # install packages to build php extensions 14 | sudo yum -y install libxml2-devel libcurl-devel libmcrypt-devel openssl-devel libpng-devel 15 | 16 | test -d ~/src || mkdir ~/src 17 | cd ~/src/ 18 | 19 | curl --location https://github.com/php/php-src/archive/php-${PHP_VER}.tar.gz -o php-${PHP_VER}.tar.gz 20 | tar xfz php-${PHP_VER}.tar.gz 21 | cd php-src-php-${PHP_VER}/ 22 | 23 | ./buildconf --force 24 | ./configure --prefix=${PHP_PREFIX}\ 25 | --enable-mbstring\ 26 | --enable-xml\ 27 | --enable-zip\ 28 | --enable-fpm\ 29 | --enable-ftp\ 30 | --enable-exif\ 31 | --enable-fileinfo\ 32 | --enable-pcntl\ 33 | --enable-pdo\ 34 | --with-curl\ 35 | --with-gd\ 36 | --with-curl\ 37 | --with-openssl\ 38 | --with-mcrypt\ 39 | --with-zlib\ 40 | --with-mysqli=mysqlnd\ 41 | --with-pdo-mysql=mysqlnd\ 42 | --without-pear\ 43 | --enable-json\ 44 | --enable-phar\ 45 | --enable-cli 46 | 47 | make -j 2 48 | 49 | sudo make install 50 | 51 | ${PHP_PREFIX}/bin/php -v 52 | -------------------------------------------------------------------------------- /ubuntu15.04/.gitignore: -------------------------------------------------------------------------------- 1 | /.vagrant/ 2 | -------------------------------------------------------------------------------- /ubuntu15.04/Vagrantfile: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | # -*- mode: ruby -*- 3 | 4 | Vagrant.configure(2) do |config| 5 | config.vm.box = "ubuntu/vivid64" 6 | config.vm.network "private_network", ip: "10.20.30.40" 7 | config.vm.provider "virtualbox" do |vb| 8 | # Customize the amount of memory on the VM: 9 | vb.memory = "2048" 10 | end 11 | 12 | config.vm.provision "shell", path: "./build-php7.sh" 13 | end 14 | -------------------------------------------------------------------------------- /ubuntu15.04/build-php7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export LC_ALL=C 6 | export PHP_VER=7.0.1 7 | export PHP_PREFIX=/opt/php 8 | 9 | sudo apt-get -y update 10 | sudo apt-get -y upgrade 11 | 12 | sudo apt-get install -y build-essential tar make gcc autoconf bison re2c 13 | sudo apt-get install -y libxml2-dev libmcrypt-dev libpng12-dev 14 | sudo apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev 15 | 16 | test -d ~/src || mkdir ~/src 17 | cd ~/src/ 18 | 19 | curl --location https://github.com/php/php-src/archive/php-${PHP_VER}.tar.gz -o php-${PHP_VER}.tar.gz 20 | tar xfz php-${PHP_VER}.tar.gz 21 | cd php-src-php-${PHP_VER}/ 22 | 23 | ./buildconf --force 24 | ./configure --prefix=${PHP_PREFIX}\ 25 | --enable-mbstring\ 26 | --enable-xml\ 27 | --enable-zip\ 28 | --enable-fpm\ 29 | --enable-ftp\ 30 | --enable-exif\ 31 | --enable-fileinfo\ 32 | --enable-pcntl\ 33 | --enable-pdo\ 34 | --with-curl\ 35 | --with-gd\ 36 | --with-curl\ 37 | --with-openssl\ 38 | --with-mcrypt\ 39 | --with-zlib\ 40 | --with-mysqli=mysqlnd\ 41 | --with-pdo-mysql=mysqlnd\ 42 | --without-pear\ 43 | --enable-json\ 44 | --enable-phar\ 45 | --enable-cli 46 | 47 | make -j 2 48 | 49 | sudo make install 50 | 51 | ${PHP_PREFIX}/bin/php -v 52 | --------------------------------------------------------------------------------