def compile(install):
    print 'Installing PHP'
    ctx = install.builder._ctx
    validate_php_version(ctx)
    validate_php_extensions(ctx)
    convert_php_extensions(ctx)
    build_php_environment(ctx)
    (install
        .package('PHP')
        .config()
            .from_application('.bp-config/php')
            .or_from_build_pack('defaults/config/php/{PHP_VERSION}')
            .to('php/etc')
            .rewrite()
            .done()
        .modules('PHP')
            .find_modules_with_regex('^extension=(.*).so$')
            .from_application('php/etc/php.ini')
            .find_modules_with_regex('^zend_extension=(.*).so$')
            .from_application('php/etc/php.ini')
            .find_modules_with_regex('^zend_extension="(?:.*/)?(.*).so"$')
            .from_application('php/etc/php.ini')
            .include_modules_from('PHP_MODULES')
            .include_module(is_web_app(ctx) and 'fpm' or 'cli')
            .done())
    return 0
    def _compile(self, install):
        ctx = install.builder._ctx

        (composer_json_file, composer_lock_file) = find_composer_paths(ctx)
        options_json_file = os.path.join(ctx['BUILD_DIR'],'.bp-config', 'options.json')

        if (os.path.isfile(options_json_file) and composer_json_file and os.path.isfile(composer_json_file)):
            # options.json and composer.json both exist. Check to see if both define a PHP version.
            composer_json = json.load(open(composer_json_file,'r'))
            options_json = json.load(open(options_json_file,'r'))

            if composer_json.get('require', {}).get('php') and options_json.get("PHP_VERSION"):
                print('WARNING: A version of PHP has been specified in both `composer.json` and `./bp-config/options.json`.')
                print('WARNING: The version defined in `composer.json` will be used.')

        print 'Installing PHP'
        validate_php_version(ctx)
        print 'PHP %s' % (ctx['PHP_VERSION'])

        major_minor = '.'.join(string.split(ctx['PHP_VERSION'], '.')[0:2])

        (install
            .package('PHP')
            .done())

        validate_php_extensions(ctx)
        convert_php_extensions(ctx)
        (install
            .config()
                .from_application('.bp-config/php')  # noqa
                .or_from_build_pack('defaults/config/php/%s.x' % major_minor)
                .to('php/etc')
                .rewrite()
                .done())
        return 0
Exemple #3
0
    def _compile(self, install):
        ctx = install.builder._ctx

        (json_file, lock_file) = find_composer_paths(ctx)
        if (os.path.isfile(
                os.path.join(ctx['BUILD_DIR'], '.bp-config', 'options.json'))
                and json_file and os.path.isfile(json_file)):
            print(
                'WARNING: A version of PHP has been specified in both `composer.json` and `./bp-config/options.json`.'
            )
            print(
                'WARNING: The version defined in `composer.json` will be used.'
            )

        print 'Installing PHP'
        validate_php_version(ctx)
        print 'PHP %s' % (ctx['PHP_VERSION'])

        major_minor = '.'.join(string.split(ctx['PHP_VERSION'], '.')[0:2])

        (install.package('PHP').done())
        validate_php_extensions(ctx)
        convert_php_extensions(ctx)
        (install.config().from_application('.bp-config/php')  # noqa
         .or_from_build_pack('defaults/config/php/%s.x' %
                             major_minor).to('php/etc').rewrite().done())
        return 0
Exemple #4
0
    def _compile(self, install):
        ctx = install.builder._ctx

        (json_file, lock_file) = find_composer_paths(ctx)
        if (os.path.isfile(os.path.join(ctx['BUILD_DIR'],'.bp-config', 'options.json')) and json_file and os.path.isfile(json_file)):
            print('WARNING: A version of PHP has been specified in both `composer.json` and `./bp-config/options.json`.');
            print('WARNING: The version defined in `composer.json` will be used.');

        print 'Installing PHP'
        validate_php_version(ctx)
        print 'PHP %s' % (ctx['PHP_VERSION'])

        major_minor = '.'.join(string.split(ctx['PHP_VERSION'], '.')[0:2])

        (install
            .package('PHP')
            .done())
        validate_php_extensions(ctx)
        convert_php_extensions(ctx)
        (install
            .config()
                .from_application('.bp-config/php')  # noqa
                .or_from_build_pack('defaults/config/php/%s.x' % major_minor)
                .to('php/etc')
                .rewrite()
                .done())
        return 0
Exemple #5
0
    def _compile(self, install):
        print 'Installing PHP'
        ctx = install.builder._ctx
        validate_php_version(ctx)
        print 'PHP %s' % (ctx['PHP_VERSION'])

        if ctx['PHP_VERSION'].startswith('5.4'):
            print('DEPRECATION WARNING: PHP 5.4 is being declared "End of Life" as of 2015-09-14')
            print('DEPRECATION WARNING: See https://secure.php.net/supported-versions.php for more details')
            print('DEPRECATION WARNING: Upgrade guide can be found at https://secure.php.net/manual/en/migration55.php')
            print('DEPRECATION WARNING: The php-buildpack will no longer support PHP 5.4 after this date')

        (install
            .package('PHP')
            .done())
        validate_php_extensions(ctx)
        convert_php_extensions(ctx)
        (install
            .config()
                .from_application('.bp-config/php')  # noqa
                .or_from_build_pack('defaults/config/php/{PHP_VERSION}')
                .to('php/etc')
                .rewrite()
                .done())
        return 0
Exemple #6
0
def compile(install):
    print 'Installing PHP'
    ctx = install.builder._ctx
    validate_php_version(ctx)
    validate_php_extensions(ctx)
    convert_php_extensions(ctx)
    build_php_environment(ctx)
    (install
        .package('PHP')
        .config()
            .from_application('.bp-config/php')  # noqa
            .or_from_build_pack('defaults/config/php/{PHP_VERSION}')
            .to('php/etc')
            .rewrite()
            .done()
        .modules('PHP')
            .find_modules_with_regex('^extension=(.*).so$')
            .from_application('php/etc/php.ini')
            .find_modules_with_regex('^zend_extension=(.*).so$')
            .from_application('php/etc/php.ini')
            .find_modules_with_regex('^zend_extension="(?:.*/)?(.*).so"$')
            .from_application('php/etc/php.ini')
            .include_modules_from('PHP_MODULES')
            .include_module(is_web_app(ctx) and 'fpm' or 'cli')
            .done())
    return 0
Exemple #7
0
 def _compile(self, install):
     print "Installing PHP"
     ctx = install.builder._ctx
     validate_php_version(ctx)
     validate_php_extensions(ctx)
     convert_php_extensions(ctx)
     print "PHP %s" % (ctx["PHP_VERSION"])
     (
         install.package("PHP")
         .config()
         .from_application(".bp-config/php")  # noqa
         .or_from_build_pack("defaults/config/php/{PHP_VERSION}")
         .to("php/etc")
         .rewrite()
         .done()
         .modules("PHP")
         .find_modules_with_regex("^extension=(.*).so$")
         .from_application("php/etc/php.ini")
         .find_modules_with_regex("^zend_extension=(.*).so$")
         .from_application("php/etc/php.ini")
         .find_modules_with_regex('^zend_extension="(?:.*/)?(.*).so"$')
         .from_application("php/etc/php.ini")
         .include_modules_from("PHP_MODULES")
         .include_module(is_web_app(ctx) and "fpm" or "cli")
         .done()
     )
     return 0
Exemple #8
0
    def _compile(self, install):
        print 'Installing PHP'
        ctx = install.builder._ctx
        validate_php_version(ctx)
        print 'PHP %s' % (ctx['PHP_VERSION'])

        major_minor = '.'.join(string.split(ctx['PHP_VERSION'], '.')[0:2])

        (install.package('PHP').done())
        validate_php_extensions(ctx)
        convert_php_extensions(ctx)
        (install.config().from_application('.bp-config/php')  # noqa
         .or_from_build_pack('defaults/config/php/%s.x' %
                             major_minor).to('php/etc').rewrite().done())
        return 0
Exemple #9
0
 def test_validate_php_extensions(self):
     ctx = {
         "ALL_PHP_EXTENSIONS": {"5.4.31": ["curl", "pgsql", "snmp", "phalcon"]},
         "PHP_VERSION": "5.4.31",
         "PHP_EXTENSIONS": ["curl", "snmp"],
     }
     validate_php_extensions(ctx)
     eq_(2, len(ctx["PHP_EXTENSIONS"]))
     assert "curl" in ctx["PHP_EXTENSIONS"]
     assert "snmp" in ctx["PHP_EXTENSIONS"]
     ctx["PHP_EXTENSIONS"] = ["curl", "pspell", "imap", "phalcon"]
     validate_php_extensions(ctx)
     eq_(2, len(ctx["PHP_EXTENSIONS"]))
     assert "curl" in ctx["PHP_EXTENSIONS"]
     assert "phalcon" in ctx["PHP_EXTENSIONS"]
 def test_validate_php_extensions(self):
     ctx = {
         'ALL_PHP_EXTENSIONS': {
             '5.4.31': ['curl', 'pgsql', 'snmp', 'phalcon']
         },
         'PHP_VERSION': '5.4.31',
         'PHP_EXTENSIONS': ['curl', 'snmp']
     }
     validate_php_extensions(ctx)
     eq_(2, len(ctx['PHP_EXTENSIONS']))
     assert 'curl' in ctx['PHP_EXTENSIONS']
     assert 'snmp' in ctx['PHP_EXTENSIONS']
     ctx['PHP_EXTENSIONS'] = ['curl', 'pspell', 'imap', 'phalcon']
     validate_php_extensions(ctx)
     eq_(2, len(ctx['PHP_EXTENSIONS']))
     assert 'curl' in ctx['PHP_EXTENSIONS']
     assert 'phalcon' in ctx['PHP_EXTENSIONS']
 def test_validate_php_extensions(self):
     ctx = {
         'ALL_PHP_EXTENSIONS': {
             '5.4.31': ['curl', 'pgsql', 'snmp', 'phalcon']
         },
         'PHP_VERSION': '5.4.31',
         'PHP_EXTENSIONS': ['curl', 'snmp']
     }
     validate_php_extensions(ctx)
     eq_(2, len(ctx['PHP_EXTENSIONS']))
     assert 'curl' in ctx['PHP_EXTENSIONS']
     assert 'snmp' in ctx['PHP_EXTENSIONS']
     ctx['PHP_EXTENSIONS'] = ['curl', 'pspell', 'imap', 'phalcon']
     validate_php_extensions(ctx)
     eq_(2, len(ctx['PHP_EXTENSIONS']))
     assert 'curl' in ctx['PHP_EXTENSIONS']
     assert 'phalcon' in ctx['PHP_EXTENSIONS']
 def _compile(self, install):
     print 'Installing PHP'
     ctx = install.builder._ctx
     validate_php_version(ctx)
     print 'PHP %s' % (ctx['PHP_VERSION'])
     (install
         .package('PHP')
         .done())
     validate_php_extensions(ctx)
     convert_php_extensions(ctx)
     (install
         .config()
             .from_application('.bp-config/php')  # noqa
             .or_from_build_pack('defaults/config/php/{PHP_VERSION}')
             .to('php/etc')
             .rewrite()
             .done())
     return 0
Exemple #13
0
    def _compile(self, install):
        ctx = install.builder._ctx

        (composer_json_file, composer_lock_file) = find_composer_paths(ctx)
        options_json_file = os.path.join(ctx['BUILD_DIR'],'.bp-config', 'options.json')

        if (os.path.isfile(options_json_file) and composer_json_file and os.path.isfile(composer_json_file)):
            # options.json and composer.json both exist. Check to see if both define a PHP version.
            composer_json = json.load(open(composer_json_file,'r'))
            options_json = json.load(open(options_json_file,'r'))

            if composer_json.get('require', {}).get('php') and options_json.get("PHP_VERSION"):
                print('WARNING: A version of PHP has been specified in both `composer.json` and `./bp-config/options.json`.')
                print('WARNING: The version defined in `composer.json` will be used.')

        if ctx.get('OPTIONS_JSON_HAS_PHP_EXTENSIONS', False):
            print("Warning: PHP_EXTENSIONS in options.json is deprecated. See: http://docs.cloudfoundry.org/buildpacks/php/gsg-php-config.html")

        print 'Installing PHP'
        validate_php_version(ctx)
        print 'PHP %s' % (ctx['PHP_VERSION'])

        major_minor = '.'.join(string.split(ctx['PHP_VERSION'], '.')[0:2])

        (install
            .package('PHP')
            .done())

        validate_php_ini_extensions(ctx)
        validate_php_extensions(ctx)
        convert_php_extensions(ctx)
        include_fpm_d_confs(ctx)

        (install
            .config()
                .from_application('.bp-config/php')  # noqa
                .or_from_build_pack('defaults/config/php/%s.x' % major_minor)
                .to('php/etc')
                .rewrite()
                .done())

        return 0