Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

phpenv (9) Versions 0.7.1

Installs/Configures phpenv

Policyfile
Berkshelf
Knife
cookbook 'phpenv', '~> 0.7.1', :supermarket
cookbook 'phpenv', '~> 0.7.1'
knife supermarket install phpenv
knife supermarket download phpenv
README
Dependencies
Changelog
Quality 17%

phpenv Cookbook | Build Status

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.

Requirements

  • build-essential
  • apt

Attributes

phpenv::default

<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><tt>['phpenv']['user']</tt></td>
<td>String</td>
<td>Default user</td>
<td><tt>phpenv</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['user_home']</tt></td>
<td>String</td>
<td>User home</td>
<td><tt>/home/phpenv</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['manage_home']</tt></td>
<td>Boolean</td>
<td>Manage home</td>
<td><tt>true</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['group']</tt></td>
<td>String</td>
<td>Group to used</td>
<td><tt>phpenv</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['group_users']</tt></td>
<td>Array</td>
<td>User in the group</td>
<td><tt>[]</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['root_path']</tt></td>
<td>String</td>
<td>Path to install phpenv</td>
<td><tt>/opt/phpenv</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['create_profiled']</tt></td>
<td>Boolean</td>
<td>Create file in profile.d</td>
<td><tt>true</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['git_force_update']</tt></td>
<td>Boolean</td>
<td>Force update phpenv git repository</td>
<td><tt>true</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['git_repository']</tt></td>
<td>String</td>
<td>Git repository for phpenv</td>
<td><tt>https://github.com/CHH/phpenv.git</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['git_reference']</tt></td>
<td>String</td>
<td>Git reference for the git repository</td>
<td><tt>master</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['php-build']['git_force_update']</tt></td>
<td>Boolean</td>
<td>Force update php-build git repository</td>
<td><tt>true</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['php-build']['git_repository']</tt></td>
<td>String</td>
<td>Git repository for php-build</td>
<td><tt>https://github.com/CHH/php-build.git</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['php-build']['git_reference']</tt></td>
<td>String</td>
<td>Git reference for the git repository</td>
<td><tt>master</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['php-build']['git_sync_path']</tt></td>
<td>String</td>
<td>Git repository cache path/td>
<td><tt>/tmp</tt></td>
</tr>
<tr>
<td><tt>['phpenv']['php-build']['packages']</tt></td>
<td>Array</td>
<td>Packages to install</td>
<td><tt>git</tt></td>
</tr>
</table>

Resources and providers

phpenv_build

This resource installs a specified version of PHP.

Actions

<table>
<thead>
<tr>
<th>Action</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>:install</td>
<td>
Build and install a PHP version.
</td>
<td>Yes</td>
</tr>
</tbody>
</table>

Attributes

<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>version</td>
<td>
<b>Name attribute:</b> the name of a PHP version (e.g. 5.3.28)
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>user</td>
<td>
A users's isolated phpenv installation on which to apply an action. The default value of <code>nil</code> denotes a system-wide phpenv installation is being targeted. <b>Note:</b> if specified, the user must already exist.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>root_path</td>
<td>
The path prefix to phpenv installation, for example:
<code>/opt/phpenv</code>.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>environment</td>
<td>
A hash of environment variables to set before running this command.
</td>
<td><code>nil</code></td>
</tr>
</tbody>
</table>

Examples

Install PHP 5.3.28
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.

phpenv_script

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.

Actions

<table>
<thead>
<tr>
<th>Action</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>run</td>
<td>Run the script</td>
<td>Yes</td>
</tr>
</tbody>
</table>

Attributes

<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td>
<b>Name attribute:</b> Name of the command to execute.
</td>
<td>name</td>
</tr>
<tr>
<td>phpenv_version</td>
<td>
A version of PHP being managed by phpenv.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>root_path</td>
<td>
The path prefix to phpenv installation, for example:
<code>/opt/phpenv</code>.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>code</td>
<td>
Quoted script of code to execute or simply a path to a file to execute in phpenv context.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>creates</td>
<td>
A file this command creates - if the file exists, the command will not be run.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>cwd</td>
<td>
Current working directory to run the command from.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>environment</td>
<td>
A hash of environment variables to set before running this command.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>group</td>
<td>
A group or group ID that we should change to before running this command.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>path</td>
<td>
An array of paths to use when searching for the command.
</td>
<td><code>nil</code>, uses system path</td>
</tr>
<tr>
<td>returns</td>
<td>
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.
</td>
<td><code>0</code></td>
</tr>
<tr>
<td>timeout</td>
<td>
How many seconds to let the command run before timing out.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>user</td>
<td>
A users's isolated phpenv installation on which to apply an action. The default value of <code>nil</code> denotes a system-wide phpenv installation is being targeted. <b>Note:</b> if specified, the user must already exist.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>umask</td>
<td>
Umask for files created by the command.
</td>
<td><code>nil</code></td>
</tr>
</tbody>
</table>

Examples

Reload cache by running command
phpenv_script 'reload-cache' do
  phpenv_version '5.4.0'
  user           'deploy'
  group          'deploy'
  cwd            '/opt/shared'
  code           './reload-cache.php'
end

phpenv_global

This resource sets the global version of PHP to be used in all shells.

Actions

<table>
<thead>
<tr>
<th>Action</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>create</td>
<td>
Sets the global version of PHP to be used in all shells.
</td>
<td>Yes</td>
</tr>
</tbody>
</table>

Attributes

<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>phpenv_version</td>
<td>
<b>Name attribute:</b> a version of PHP being managed by phpenv.
<b>Note:</b> the version of PHP must already be installed but not installed it automatically.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>user</td>
<td>
A users's isolated phpenv installation on which to apply an action. The default value of <code>nil</code> denotes a system-wide phpenv installation is being targeted.
<b>Note:</b> if specified, the user must already exist.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>root_path</td>
<td>
The path prefix to phpenv installation, for example:
<code>/opt/phpenv</code>.
</td>
<td><code>nil</code></td>
</tr>
</tbody>
</table>

Examples

Set PHP 5.3.28 as global
phpenv_global "5.3.28"
Set system php version as global
phpenv_global 'system'
Set PHP 5.4.0 as global for a user
phpenv_global '5.4.0' do
  user 'bamboo'
end

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Authors:

Dependent cookbooks

apt >= 0.0.0
build-essential >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

phpenv CHANGELOG

This file is used to list changes made in each version of the phpenv cookbook.

0.7.1

  • [pyama86] - add attributes git_sync_path

0.7.0

  • [Pierre Rambaud] - Bug with PHPENV_VERSION environment variable, use RBENV_VERSION instead.

0.5.1

  • [Pierre Rambaud] - Fix typo

0.5.0

  • [Pierre Rambaud] - Update dependencies

0.4.0

  • [Pierre Rambaud] - Add libssl and libreadline packages

0.3.0

  • [Pierre Rambaud] - Fix bug on ubuntu 14.04

0.2.0

  • [Pierre Rambaud] - More Attributes, add supported OS, remove useless comments, more tests

0.1.0

  • [Pierre Rambaud] - Initial release of phpenv cookbook

Collaborator Number Metric
            

0.7.1 failed this metric

Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.7.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.7.1 failed this metric

FC009: Resource attribute not recognised: phpenv/providers/script.rb:27
FC009: Resource attribute not recognised: phpenv/recipes/default.rb:34
FC064: Ensure issues_url is set in metadata: phpenv/metadata.rb:1
FC065: Ensure source_url is set in metadata: phpenv/metadata.rb:1
FC066: Ensure chef_version is set in metadata: phpenv/metadata.rb:1
FC069: Ensure standardized license defined in metadata: phpenv/metadata.rb:1
FC074: LWRP should use DSL to define resource's default action: phpenv/resources/build.rb:1
FC074: LWRP should use DSL to define resource's default action: phpenv/resources/global.rb:1
FC074: LWRP should use DSL to define resource's default action: phpenv/resources/script.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: phpenv/providers/build.rb:25
FC085: Resource using new_resource.updated_by_last_action to converge resource: phpenv/providers/global.rb:34
FC085: Resource using new_resource.updated_by_last_action to converge resource: phpenv/providers/script.rb:41
FC121: Cookbook depends on cookbook made obsolete by Chef 14: phpenv/metadata.rb:1
FC122: Use the build_essential resource instead of the recipe: phpenv/recipes/default.rb:22
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

0.7.1 passed this metric

Testing File Metric
            

0.7.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.7.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number