Both plain PHP.net and HHVM interpreters are supported. Some extensions cannot be installed with HHVM as they are not yet bundled.
<?php

/*
 * This file is part of the Stash package.
 *
 * (c) Robert Hafner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * Install PHP extensions for Travis CI.
 *
 * @author Victor Berchet <*****@*****.**>
 */
$installer = new PhpExtensions();
$installer->install('apc');
$installer->install('memcache');
$installer->install('memcached');
class PhpExtensions
{
    protected $extensions;
    protected $phpVersion;
    protected $iniPath;
    public function __construct()
    {
        $this->phpVersion = phpversion();
        $this->iniPath = php_ini_loaded_file();
        $this->extensions = array('memcache' => array('url' => 'http://pecl.php.net/get/memcache-2.2.6.tgz', 'php_version' => array(), 'cfg' => array('--enable-memcache'), 'ini' => array('extension=memcache.so')), 'memcached' => array('url' => 'http://pecl.php.net/get/memcached-1.0.2.tgz', 'php_version' => array(array('<', '5.4')), 'cfg' => array(), 'ini' => array('extension=memcached.so')), 'apc' => array('url' => 'http://pecl.php.net/get/APC-3.1.9.tgz', 'php_version' => array(array('<', '5.4')), 'cfg' => array(), 'ini' => array('extension=apc.so', 'apc.enabled=1', 'apc.enable_cli=1', 'apc.max_file_size=1')), 'xcache' => array('url' => 'http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz', 'php_version' => array(array('<', '5')), 'cfg' => array('--enable-xcache'), 'ini' => array('extension=xcache.so', 'xcache.admin.enable_auth=0', 'xcache.var_size=1M', 'xcache.cacher=false')));
    }
    public function install($name)
示例#2
0
#!/usr/bin/env php

<?php 
set_time_limit(0);
$installer = new PhpExtensions();
if (isset($argv[1]) && 'APC' === strtoupper($argv[1])) {
    $installer->install('apc');
} else {
    $installer->install('xcache');
}
$installer->install('memcached');
$installer->install('mongo');
class PhpExtensions
{
    protected $extensions;
    protected $phpVersion;
    protected $iniPath;
    public function __construct()
    {
        $this->phpVersion = phpversion();
        $this->iniPath = php_ini_loaded_file();
        $this->extensions = array('memcached' => array('url' => 'http://pecl.php.net/get/memcached-2.0.1.tgz', 'require' => array(), 'configure' => array(), 'ini' => array('extension=memcached.so')), 'apc' => array('url' => 'http://pecl.php.net/get/APC-3.1.10.tgz', 'require' => array(), 'configure' => array(), 'ini' => array('extension=apc.so', 'apc.enabled=1', 'apc.enable_cli=1')), 'xcache' => array('url' => 'http://xcache.lighttpd.net/pub/Releases/1.3.2/xcache-1.3.2.tar.gz', 'require' => array('php' => array('<', '5.4')), 'configure' => array('--enable-xcache'), 'ini' => array('extension=xcache.so', 'xcache.cacher=false', 'xcache.admin.enable_auth=0', 'xcache.var_size=1M')), 'mongo' => array('url' => 'http://pecl.php.net/get/mongo-1.2.7.tgz', 'require' => array(), 'configure' => array(), 'ini' => array('extension=mongo.so')));
    }
    public function install($name)
    {
        if (array_key_exists($name, $this->extensions)) {
            $extension = $this->extensions[$name];
            echo $name;
            if (isset($extension['require']['php'])) {
                $version = $extension['require']['php'];
                if (!version_compare($this->phpVersion, $version[1], $version[0])) {
示例#3
0
#!/usr/bin/env php
<?php 
/**
 * Lithium: the most rad php framework
 *
 * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */
if (isset($argv[1]) && 'APC' === strtoupper($argv[1])) {
    PhpExtensions::install('apc');
} else {
    PhpExtensions::install('xcache');
}
PhpExtensions::install('mongo');
/**
 * Class to install native PHP extensions mainly
 * for preparing test runs.
 */
class PhpExtensions
{
    /**
     * Holds build, configure and install instructions for PHP extensions.
     *
     * @var array Extensions to build keyed by extension name.
     */
    protected static $_extensions = array('memcached' => array('url' => 'http://pecl.php.net/get/memcached-2.0.1.tgz', 'require' => array(), 'configure' => array(), 'ini' => array('extension=memcached.so')), 'apc' => array('url' => 'http://pecl.php.net/get/APC-3.1.10.tgz', 'require' => array(), 'configure' => array(), 'ini' => array('extension=apc.so', 'apc.enabled=1', 'apc.enable_cli=1')), 'xcache' => array('url' => 'http://xcache.lighttpd.net/pub/Releases/1.3.2/xcache-1.3.2.tar.gz', 'require' => array('php' => array('<', '5.4')), 'configure' => array('--enable-xcache'), 'ini' => array('extension=xcache.so', 'xcache.cacher=false', 'xcache.admin.enable_auth=0', 'xcache.var_size=1M')), 'mongo' => array('url' => 'http://pecl.php.net/get/mongo-1.2.7.tgz', 'require' => array(), 'configure' => array(), 'ini' => array('extension=mongo.so')));
    /**
     * Install extension by given name.
     *
     * Uses configration retrieved as per `php_ini_loaded_file()`.
     *
示例#4
0
#!/usr/bin/env php
<?php 
/**
 * Lithium: the most rad php framework
 *
 * @copyright     Copyright 2012, Union of RAD (http://union-of-rad.org)
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */
PhpExtensions::install('redis');
/**
 * Class to install native PHP extensions mainly
 * for preparing test runs.
 */
class PhpExtensions
{
    /**
     * Holds build, configure and install instructions for PHP extensions.
     *
     * @var array Extensions to build keyed by extension name.
     */
    protected static $_extensions = array('redis' => array('url' => 'https://github.com/nicolasff/phpredis/archive/2.2.2.tar.gz', 'require' => array(), 'configure' => array(), 'ini' => array('extension=redis.so')));
    /**
     * Install extension by given name.
     *
     * Uses configration retrieved as per `php_ini_loaded_file()`.
     *
     * @see http://php.net/php_ini_loaded_file
     * @param string $name The name of the extension to install.
     * @return void
     */
    public static function install($name)
示例#5
0
#!/usr/bin/env php
<?php 
/**
 * Lithium: the most rad php framework
 *
 * @copyright     Copyright 2016, Union of RAD (http://union-of-rad.org)
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */
use RuntimeException;
foreach (explode(' ', getenv('PHP_EXT')) ?: array() as $extension) {
    PhpExtensions::install($extension);
}
/**
 * Class to install native PHP extensions mainly for preparing test runs
 * in continuous integration environments like Travis CI.
 *
 * Both plain PHP.net and HHVM interpreters are supported. Some extensions
 * cannot be installed with HHVM as they are not yet bundled.
 *
 * @link https://github.com/facebook/hhvm/wiki/Extensions
 */
class PhpExtensions
{
    /**
     * Install extension by given name.
     *
     * @param string $name The name of the extension to install.
     * @return void
     */
    public static function install($name)
    {