Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install More Specific PHP Version #404

Open
XedinUnknown opened this issue Mar 7, 2019 · 0 comments
Open

Install More Specific PHP Version #404

XedinUnknown opened this issue Mar 7, 2019 · 0 comments

Comments

@XedinUnknown
Copy link

XedinUnknown commented Mar 7, 2019

Very often, there is a need to change the patch version of PHP installed. For example, my team's policy is that we support at least PHP 7.0.33 (latest patch), and therefore the development environment must be at that version.

A. Update OS Package

One way of doing this is described here. Basically, after logging into your environment (vagrant ssh), you find out what PHP versions are available to you:

sudo apt show -a php7.0 | grep Version

This will produce output, e.g.

Version: 7.0.33-0ubuntu0.16.04.2
Version: 7.0.18-0ubuntu0.16.04.1
Version: 7.0.4-7ubuntu2

Once you know this, you can install a specific version:

sudo apt-get install php7.0=7.0.33-0ubuntu0.16.04.2

B. Build for Specific Requirements

If you have very specific requirements, especially if you need PHP compiled in a certain way, one good solution is using phpbrew. This will allow you to build any PHP version. Be aware, however, that since you are building PHP in your dev environment, that environment will need to contain build requirements, which are very often devel-level packages. There is no definitive list of packages you need, because build requirements for each specific PHP version is different. You can find an example of doing this here.

  1. Install build requirements. These are the different OS packages that are needed to build my specific version, which in that example is PHP 5.5.10.
  2. Install phpbrew. Pretty straight-forward sequence according to the manual, which will result in it having an up-to-date version of recipes.
  3. Compile PHP. Creates a new version available to PHPBrew with specific extensions, and also adds code to the startup script. This helps with running phpbrew in the future.
  4. Switch to new PHP version. This means that the version will now become available.

Another similar approach is by using phpenv, which is gaining popularity.

@XedinUnknown XedinUnknown changed the title Upgrade PHP Patch Install More Specific PHP Version Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant