Manage installation of multiple PHP versions via phpenv and php-build. Also provides a set of lightweight resources and providers.
If you've used rbenv or pyenv, this is a port of that concept for PHP.
build-essential
apt
Key | Type | Description | Default |
---|---|---|---|
['phpenv']['user'] | String | Default user | phpenv |
['phpenv']['user_home'] | String | User home | /home/phpenv |
['phpenv']['manage_home'] | Boolean | Manage home | true |
['phpenv']['group'] | String | Group to used | phpenv |
['phpenv']['group_users'] | Array | User in the group | [] |
['phpenv']['root_path'] | String | Path to install phpenv | /opt/phpenv |
['phpenv']['create_profiled'] | Boolean | Create file in profile.d | true |
['phpenv']['git_force_update'] | Boolean | Force update phpenv git repository | true |
['phpenv']['git_repository'] | String | Git repository for phpenv | https://github.com/CHH/phpenv.git |
['phpenv']['git_reference'] | String | Git reference for the git repository | master |
['phpenv']['php-build']['git_force_update'] | Boolean | Force update php-build git repository | true |
['phpenv']['php-build']['git_repository'] | String | Git repository for php-build | https://github.com/CHH/php-build.git |
['phpenv']['php-build']['git_reference'] | String | Git reference for the git repository | master |
['phpenv']['php-build']['git_sync_path'] | String | Git repository cache path/td> | /tmp |
['phpenv']['php-build']['packages'] | Array | Packages to install | git |
This resource installs a specified version of PHP.
Action | Description | Default |
---|---|---|
:install | Build and install a PHP version. | Yes |
Attribute | Description | Default Value |
---|---|---|
version | Name attribute: the name of a PHP version (e.g. `5.3.28`) | nil |
user |
A users's isolated phpenv installation on which to apply an action. The default value of nil denotes a system-wide phpenv installation is being targeted. Note: if specified, the user must already exist.
|
nil |
root_path |
The path prefix to phpenv installation, for example:
/opt/phpenv .
|
nil |
environment | A hash of environment variables to set before running this command. | nil |
phpenv_build '5.3.28' do
action :install
end
phpenv_build '5.3.28'
Note: the install action is default, so the second example is a more common usage.
This resource is a wrapper for the script
resource which wraps the code block in an phpenv
-aware environment.
See the Opscode script resource documentation for more details.
Action | Description | Default |
---|---|---|
run | Run the script | Yes |
Attribute | Description | Default Value |
---|---|---|
name | Name attribute: Name of the command to execute. | name |
phpenv_version | A version of PHP being managed by phpenv. | nil |
root_path |
The path prefix to phpenv installation, for example:
/opt/phpenv .
|
nil |
code | Quoted script of code to execute or simply a path to a file to execute in phpenv context. | nil |
creates | A file this command creates - if the file exists, the command will not be run. | nil |
cwd | Current working directory to run the command from. | nil |
environment | A hash of environment variables to set before running this command. | nil |
group | A group or group ID that we should change to before running this command. | nil |
path | An array of paths to use when searching for the command. | nil , uses system path |
returns | The return value of the command (may be an array of accepted values) this resource raises an exception if the return value(s) do not match. | 0 |
timeout | How many seconds to let the command run before timing out. | nil |
user |
A users's isolated phpenv installation on which to apply an action. The default value of nil denotes a system-wide phpenv installation is being targeted. Note: if specified, the user must already exist.
|
nil |
umask | Umask for files created by the command. | nil |
phpenv_script 'reload-cache' do
phpenv_version '5.4.0'
user 'deploy'
group 'deploy'
cwd '/opt/shared'
code './reload-cache.php'
end
This resource sets the global version of PHP to be used in all shells.
Action | Description | Default |
---|---|---|
create | Sets the global version of PHP to be used in all shells. | Yes |
Attribute | Description | Default Value |
---|---|---|
phpenv_version | Name attribute: a version of PHP being managed by phpenv. Note: the version of PHP must already be installed but not installed it automatically. | nil |
user |
A users's isolated phpenv installation on which to apply an action. The default value of nil denotes a system-wide phpenv installation is being targeted.
Note: if specified, the user must already exist.
|
nil |
root_path |
The path prefix to phpenv installation, for example:
/opt/phpenv .
|
nil |
phpenv_global "5.3.28"
phpenv_global 'system'
phpenv_global '5.4.0' do
user 'bamboo'
end
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
Authors:
- Pierre Rambaud (pierre.rambaud@numergy.com)