Thin Wrapper around rbenv for PHP version managment

Overview

phpenv

![Gitter](https://badges.gitter.im/Join Chat.svg)

Sets up a separate rbenv environment for PHP

man page

SYNOPSIS

phpenv-install.sh
UPDATE=yes phpenv-install.sh

DESCRIPTION

The phpenv-install.sh command sets up a separate rbenv environment for usage with PHP. This environment is stored in the $HOME/.phpenv directory and contains a phpenv executable which sets the RBENV_ROOT environment variable to $HOME/.phpenv.

To install PHP versions, just put them to the $HOME/.phpenv/versions directory. You can use php-build to do this with one command:

$ php-build -i development 5.4.9 $HOME/.phpenv/versions/5.4.9
$ phpenv versions
  5.4.9
$ phpenv rehash
$ phpenv global 5.4.9
$ php --version
  PHP 5.4.9 (cli) (built: Nov 25 2012 17:27:10) 
  Copyright (c) 1997-2012 The PHP Group
  Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
      with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

The phpenv-install.sh command has an optional "update" mode which updates the $HOME/.phpenv to the latest source code from the rbenv repository and creates a new phpenv executable.

This mode is triggered by setting the UPDATE environment variable before calling phpenv-install.sh, for example:

$ UPDATE=yes phpenv-install.sh

Finally, enable phpenv in your shell by adding $HOME/.phpenv/bin and $HOME/.phpenv/shims to your PATH and adding eval "$(phpenv init -)" to your $HOME/.bash_profile or $HOME/.bashrc (or your shell's respective file) and restart your shell.

IMPORTANT NOTES

  • For rbenv users: Make sure that ~/.rbenv/bin takes precedence in the PATH over ~/.phpenv/bin by placing it before, so rbenv gets used from ~/.rbenv.

  • You need to have git installed to run the phpenv-install.sh command.

SEE ALSO

rbenv

Comments
  • Phpenv actually installing rbenv

    Phpenv actually installing rbenv

    ...I am on Mac OS 10.10.1 installing phpenv via homebrew with $brew install phpenv while after running the install-script. After typing phpenv in my shell I get rbenv 0.4.0 output. Is this due to the line https://github.com/CHH/phpenv/blob/master/bin/phpenv-install.sh#L26 indicating that the actually rbenv is installed right now?

    Cheers.

    opened by tdeekens 3
  • Use a phpenv specific filename for local version selection

    Use a phpenv specific filename for local version selection

    Appreciate this probably breaks BC, but it saves me from getting

    Unknown ruby interpreter version: '5.4.8'
    

    every time I move in to a directory where I'm using phpenv rather than rbenv.

    I don't know what's invoking ruby when I move in to a dir, but it's probably something to do with oh-my-zsh.

    opened by davedevelopment 3
  • Add an extensions directory with conig-add and config-rm commands

    Add an extensions directory with conig-add and config-rm commands

    Hi Chirstoph,

    As mentioned in travis-ci/travis-ci#511, I extended phpenv with two commands that allow to add (or remove) custom configuration files to the conf.d directory of the currently used PHP version:

    • phpenv config-add
    • phpenv config-rm

    Right now phpenv is a simple and standalone install script, so I put these commands in an extensions directory. Users can then manually take these extensions and copy them in their own rbenv installation directory if needed. This procedure should however be documented: I can take care of this documentation if you agree to integrate these extensions directly into phpenv's repository.

    If you think that it does not make sense to supply these two commands with phpenv, I of course won't take it badly and I'll consider embedding them as extensions to phpenv in Travis directly :smiley:

    opened by loicfrering 3
  • Bug: phpenv shell not found on the ubuntu

    Bug: phpenv shell not found on the ubuntu

    Hi, I have fixed the issue that the phpenv shell command not found on the ubuntu refer to issue #24 . Please kindly merge to master. Or let me know if it have to fix anything.

    Include commited from @Milly - Pull Request #13 Refer to Issue : https://github.com/CHH/phpenv/issues/24

    opened by scalopus 1
  • Wrong message when trying to use PHP-CGI if not available

    Wrong message when trying to use PHP-CGI if not available

    when trying to use CGI on PHP 5.3 on travis (which does not have CGI on 5.3), the following message is displayed:

    rbenv: php-cgi: command not found
    
    The `php-cgi' command exists in these Ruby versions:
    5.2
    5.2.17
    5.3.3
    5.4
    5.4.13
    5.5
    5.5.0beta1
    

    This message is useful, but it would be better if it was talking about PHP versions rather than Ruby versions. Originally reported as https://github.com/travis-ci/travis-ci/issues/1078

    opened by stof 1
  • be copyable to use

    be copyable to use

    hi @CHH. Thanks for phpenv, and php-build. just tiny fix for more copyable to use. Thanks.

    before:

    Success.
    
    Now add /home/ec2-user/.phpenv/bin to your $PATH, add 'eval "$(phpenv init -)"' at the end of your ~/.bashrc and restart your shell to use phpenv.
    
    

    after:

    Success.
    
    export PATH="/Users/banyan/.phpenv/bin:$PATH"
    eval "$(phpenv init -)"
    
    Add above line at the end of your ~/.bashrc and restart your shell to use phpenv.
    
    
    opened by banyan 1
  • Fix shell quoting of phpenv-install message after install

    Fix shell quoting of phpenv-install message after install

    After installing phpenv, the phpenv-install tells such as:

    Now add ~/.phpenv/bin to your $PATH, add "eval $(phpenv init -)" at the end of your ~/.bashrc and restart your shell to use phpenv.
    

    However, eval "$(phpenv init -)" is correct.

    opened by hnw 1
  • How could I use pear command per env?

    How could I use pear command per env?

    At first, let me say thank you for your great products: phpenv and php-build. They're really help my development.

    BTW, I want to install some PEAR libraries into each envs.

    When I installed any PHP with phpenv, ./bin directory have php, phar, pyrus and so on, but there is no pear.

    How could I do that?

    opened by yuya-takeyama 1
  • Support -f flag on config-rm to avoid exit 1 on missing config

    Support -f flag on config-rm to avoid exit 1 on missing config

    When using config-rm to disable for instance xdebug, it will fail with exit 1 on hhvm vm's of travis as there is no xdebug installed. While other ways to solve that, it would be nice to be able to specify a -f flag silencing it if file is missing.

    opened by andrerom 0
  • Add a Gitter chat badge to README.md

    Add a Gitter chat badge to README.md

    opened by gitter-badger 0
  • I can't download xdebug package.

    I can't download xdebug package.

    Hi, I installed phpenv, and I try to get php 7.1.1. but I met this error( below).

    -----install log---- [xdebug]: Installing version 2.6.0, [Downloading]: http://xdebug.org/files/xdebug-2.6.0.tgz, curl: (7) Failed connect to xdebug.org:80; Connection timed out,

    I access to 'http://xdebug.org/files/xdebug-2.6.0.tgz' by curl, I receive Request Code 302. Next, I try to add '-L' option, I can get this package.

    My guess is that, When you get xdebug package by curl, do you need "-L" option? Pls check get package method.

    Best regards,

    opened by delphinz 0
  • Replace RBENV_VERSION with PHPENV_VERSION variable (Depends on fix-update)

    Replace RBENV_VERSION with PHPENV_VERSION variable (Depends on fix-update)

    This will replace RBENV_VERSION with PHPENV_VERSION so you can separately specify PHP and Ruby versions.

    Note: this will break any plugins or supporting scripts that assume phpenv uses RBENV_VERSION (phpenv-composer being one)

    opened by 3onyc 0
  • Fix the update functionality

    Fix the update functionality

    This pull request fixes update functionality by first resetting the repository (using git checkout), pulling, and then reapplying the sed replacements.

    Fixes #41

    opened by 3onyc 0
  • `phpenv versions` includes versions that were not successfully installed

    `phpenv versions` includes versions that were not successfully installed

    If I run phpenv versions, it seems that versions are included in the output which were not successfully installed.

    > phpenv versions
      system
    * 5.3.29 (set by /mnt/jenkins-slave-workspace/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/phpenv/phpenv/version)
      5.4.45
      5.5.31
      5.5.35
      5.6.17
      5.6.21
      7.0.5
      7.0.6
    > phpenv local 5.5.35
    > php --version
    rbenv: php: command not found
    
    The `php' command exists in these Ruby versions:
      5.3.29
      5.4.45
      5.5.31
      5.6.17
      7.0.5
      7.0.6
    
    > ls $phpenv_HOME/phpenv/versions/5.5.35
    etc  libexec
    
    opened by joshuaspence 1
  • RBENV_VERSION environment variable is used

    RBENV_VERSION environment variable is used

    When I run phpenv help the output text seems to refer to rbenv rather than phpenv. Furthermore, the PHPENV_VERSION environment variable seems to do nothing whereas RBENV_VERSION seems to work.

    > phpenv
    rbenv 1.0.0-16-gd6ab394
    Usage: rbenv <command> [<args>]
    
    Some useful rbenv commands are:
       commands    List all available rbenv commands
       local       Set or show the local application-specific Ruby version
       global      Set or show the global Ruby version
       shell       Set or show the shell-specific Ruby version
       rehash      Rehash rbenv shims (run this after installing executables)
       version     Show the current Ruby version and its origin
       versions    List all Ruby versions available to rbenv
       which       Display the full path to an executable
       whence      List all Ruby versions that contain the given executable
    
    See `rbenv help <command>' for information on a specific command.
    For full documentation, see: https://github.com/rbenv/rbenv#readme
    
    > phpenv version
    rbenv: version `5.3.29' is not installed (set by RBENV_VERSION environment variable)
     (set by RBENV_VERSION environment variable)
    
    opened by joshuaspence 1
Owner
Christoph Hochstrasser
Christoph Hochstrasser
Brew & manage PHP versions in pure PHP at HOME

PHPBrew Read this in other languages: English, Português - BR, 日本語, 中文. phpbrew builds and installs multiple version php(s) in your $HOME directory. W

PHPBrew 5k Jan 9, 2023
Builds PHP so that multiple versions can be used side by side.

php-build php-build is a utility for building versions of PHP to use them side by side with each other. The overall structure is loosly borrowed from

php-build 959 Dec 14, 2022
virtPHP is a tool to create isolated PHP environments.

virtPHP is a tool for creating and managing multiple isolated PHP environments on a single machine. It's like Python's virtualenv, but for PHP. virtPH

VirtPHP 538 Sep 14, 2022
🔰 Instant PHP quality checks from your console

PHP Insights was carefully crafted to simplify the analysis of your code directly from your terminal, and is the perfect starting point to analyze the code quality of your PHP projects.

Nuno Maduro 4.8k Dec 27, 2022
A thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache tagging and indexing.

Apix Cache, cache-tagging for PHP Apix Cache is a generic and thin cache wrapper with a PSR-6 interface to various caching backends and emphasising ca

Apix 111 Nov 26, 2022
A Restfull backend api for tasks managment

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Kpanou Gilles 3 Aug 2, 2021
User Authentication Managment With Laravel 8

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

null 17 Jul 17, 2022
Binance Connector PHP - a thin library that working as a connector to the Binance public API

Binance Connector PHP This is a thin library that working as a connector to the Binance public API. Installation composer require binance/binance-conn

Binance 13 Nov 1, 2022
Thin assertion library for use in libraries and business-model

Assert A simple php library which contains assertions and guard methods for input validation (not filtering!) in business-model, libraries and applica

Benjamin Eberlei 2.3k Dec 23, 2022
A thin and light scaffolded Laravel Dusk environment.

Laravel Husk Larvel Husk is a thin and light scaffolded Laravel Dusk environment. It allows you to test your JavaScript applications with PHP using Pe

Steve Bauman 85 Dec 26, 2022
A PHP wrapper around the Git command line utility.

Git Wrapper provides a readable API that abstracts challenges of executing Git commands from within a PHP process for you.

Chris Pliakas 503 Nov 21, 2022
A slim PHP wrapper around wkhtmltopdf with an easy to use and clean OOP interface

PHP WkHtmlToPdf PHP WkHtmlToPdf provides a simple and clean interface to ease PDF and image creation with wkhtmltopdf. The wkhtmltopdf and - optionall

Michael Härtl 1.5k Dec 25, 2022
A PHP wrapper around the OpenSSL extension that provides a user-friendly interface for dealing with OpenSSL.

php-openssl-proxy About A PHP wrapper around the OpenSSL extension that provides a user-friendly interface for dealing with OpenSSL. What's up with th

Adão Pedro 4 Mar 5, 2022
An object oriented wrapper around PHP's built-in server.

Statix Server Requirements PHP 8 minumum Installation composer require statix/server Basic Usage To get started, ensure the vendor autoload script is

Statix PHP 113 Dec 27, 2022
A PHP wrapper around Libreoffice for converting documents from one format to another.

Document Converter A PHP wrapper around Libreoffice for converting documents from one format to another. For example: Microsoft Word to PDF OpenOffice

Lukas White 0 Jul 28, 2022
A simple wrapper around vlucas' PHP dotenv library for Kirby CMS.

kirby-phpdotenv A simple wrapper around vlucas' PHP dotenv library for Kirby CMS. Why? I've been using .env in my Kirby projects for a while, but I go

Steve Jamesson 5 Feb 6, 2020
Laravel wrapper around OAuth 1 & OAuth 2 libraries.

Introduction Laravel Socialite provides an expressive, fluent interface to OAuth authentication with Facebook, Twitter, Google, LinkedIn, GitHub, GitL

The Laravel Framework 5.2k Dec 27, 2022
A developer-friendly wrapper around execution of shell commands.

ptlis/shell-command A developer-friendly wrapper around execution of shell commands. There were several goals that inspired the creation of this packa

brian ridley 18 Dec 31, 2022
WordPlate is a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

WordPlate is simply a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

WordPlate 1.7k Dec 24, 2022
An elegant wrapper around Google Vision API

STILL UNDER DEVELOPMENT - DO NOT USE IN PRODUCTION Requires PHP 8.0+ For feedback, please contact me. This package provides an elegant wrapper around

Ahmad Mayahi 24 Nov 20, 2022