• Home
  • Health
  • Software
  • Blog
  • php

    Installing PHPenv

    Go here: https://github.com/phpenv/phpenv


    Install by using git clone, or just downloading the zip to this location:

    git clone git@github.com:phpenv/phpenv.git ~/.phpenv
    

    Add it to the path:

    echo 'export PATH="$HOME/.phpenv/bin:$PATH"' >> ~/.bash_profile
    # or
    echo 'export PATH="$HOME/.phpenv/bin:$PATH"' >> ~/.zprofile
    

    Add autocompletion:

    echo 'eval "$(phpenv init -)"' >> ~/.bash_profile
    # or
    echo 'eval "$(phpenv init -)"' >> ~/.zprofile
    

    Restart shell:

    exec $SHELL -l
    


    Then, go here: https://github.com/php-build/php-build


    Install php-build as a plugin, either using the script (which only works if you used git clone at the beginning) or manually putting it into the .phpenv/plugins directory (which probably won't exist, so create it)


    Run this to see what versions are available:

    phpenv install -l
    


    Then, install a version, e.g.:

    phpenv install 5.6.40
    


    (If on Mac, first make sure autoconf is installed:)

    brew install autoconf automake libtool