aboutsummaryrefslogtreecommitdiff
blob: 7d1400c3b3024b10bcbbd3e9e8186eb56ef520a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @license GNU General Public License, version 2 (GPL-2.0)
#
# For full copyright and license information, please see
# the docs/CREDITS.txt file.
#
set -e
set -x

function find_php_ini
{
	echo $(php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||")
}

# $1 - PHP extension name
# $2 - PHP ini file path
function register_php_extension
{
	echo "extension=$1.so" >> "$2"
}

# $1 - PHP extension name
# $2 - PHP ini file path
function install_php_extension
{
	echo "Installing $1 PHP extension"

	# See http://www.php.net/manual/en/install.pecl.phpize.php
	cd "$1"
	phpize
	./configure
	make
	make install
	cd ..

	register_php_extension "$1" "$2"
}

php_ini_file=$(find_php_ini)

# Disable opcache for testing
echo 'Disabling Opcache'
echo 'opcache.enable=0' >> "$php_ini_file"

# APCu
if [ `php -r "echo (int) (version_compare(PHP_VERSION, '7.0.0-dev', '>=') && version_compare(PHP_VERSION, '7.3.0-dev', '<'));"` == "1" ]
then
	if ! [ "$(pecl info pecl/apcu)" ]
	then
		echo 'Enabling APCu PHP extension'
		printf "\n" | pecl install apcu
		echo 'apc.enabled=1' >> "$php_ini_file"
		echo 'apc.enable_cli=1' >> "$php_ini_file"
	fi
fi


# redis
# Disabled redis for now as it causes travis to fail
# git clone git://github.com/nicolasff/phpredis.git redis
# install_php_extension 'redis' "$php_ini_file"