Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Followup #667, #714: Make it easier to switch between PHP versions #1043

Merged
merged 6 commits into from
Dec 10, 2016

Conversation

oxyc
Copy link
Collaborator

@oxyc oxyc commented Dec 9, 2016

Doesn't work but I'm pushing to see if I can get travis to help out.

Sorry, I made a duplicate PR for this because rebasing caused a headache.

@oxyc
Copy link
Collaborator Author

oxyc commented Dec 9, 2016

Aha, the matrix didn't work as I thought it did (travis-ci/travis-ci#1519).

@oxyc
Copy link
Collaborator Author

oxyc commented Dec 9, 2016

Tested locally:

  • Ubuntu 16.04: PHP 7.0, xdebug/xhprof/redis/memcached
  • Ubuntu 16.04: PHP 7.0, rebuild 5.6
  • Ubuntu 16.04: PHP 7.0, rebuild 5.6, rebuild 7.1
  • Ubuntu 16.04: PHP 7.0, rebuild 5.6, rebuild 7.1, rebuild 5.5
  • Ubuntu 14.04: PHP 7.0
  • Ubuntu 14.04: PHP 7.0, rebuild 5.6
  • Ubuntu 14.04: PHP 7.0, rebuild 5.6, rebuild 7.1
  • Ubuntu 14.04: PHP 7.0, rebuild 5.6, rebuild 7.1, rebuild 5.5
  • Ubuntu 12.04: PHP 5.6
  • Ubuntu 12.04: PHP 5.6, Redis. Does not work! Redis was not installed and the package is called php-redis. @geerlingguy I see it's installing from source on 12.04. Running php -m did not list the module when I tried. sudo apt-get install php-redis did work. Fixed with Dont force source install on Ubuntu 12.04 ansible-role-php-redis#2
  • Ubuntu 12.04: PHP 5.6, Memcached. Works, php-memcached
  • Ubuntu 12.04: PHP 5.6, Memcached; rebuild 7.0. Works, php-memcached
  • Ubuntu 12.04: PHP 5.6, Memcached; rebuild 7.0; rebuild 7.1. Works, php-memcached
  • Ubuntu 14.04: PHP 7.1, XDebug. Fails, currently ondrejs version doesn't support 7.1. Fixed fixed in Support PHP 7.1 with bumping xdebug version ansible-role-php-xdebug#39
  • Ubuntu 14.04: PHP 7.1, XHProf. Fails.
  • Ubuntu 14.04: PHP 7.1, Postgresql, Redis, Memcached. Works.,php-memcached and php-redis.
  • Ubuntu 14.04: PHP 7.1, Postgresql, Redis, Memcached; rebuild 7.0, XDebug, XHprof. Works, php-memcached and php-redis.
  • Ubuntu 14.04: PHP 7.1, Postgresql, Redis, Memcached; rebuild 7.0, XDebug, XHprof; rebuild 5.6. Failed at first attempt, see todo below. I nuked the drupal/ directory and re-provisioned after which Drupal memcached/redis does work but xdebug isnt loaded. Can't reproduce this so I'll call it fixed.

Todo: Ubuntu 14.04, php7.1 rebuilt to 7.0 and rebuilt to 5.6 causes white screen of death, no log output and the following:

vagrant@drupalvm-php:~$ php --version
Failed loading /usr/lib/php5/modules/xdebug.so:  /usr/lib/php5/modules/xdebug.so: undefined symbol: zend_sort
PHP 5.6.29-1+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

@oxyc
Copy link
Collaborator Author

oxyc commented Dec 9, 2016

@geerlingguy do you want me to add any test for building with another version than the default? Also do you remember what the opcache.ini naming issue was? Wondering if it's something I should test that doesn't creep up again.

@oxyc
Copy link
Collaborator Author

oxyc commented Dec 9, 2016

The module purge could be avoided by setting a version specific module path so modules that require compiling like xdebug & xhprof would have a separate module path per version. The PR's referenced above would allow us to remove this purge task -- https://github.com/beetboxvm/beetbox/blob/master/provisioning/ansible/roles/beetbox-php-ppa/tasks/main.yml#L18 - @thom8 (ref)

geerlingguy/ansible-role-php-xdebug#32
geerlingguy/ansible-role-php-xhprof#16

@geerlingguy
Copy link
Owner

@oxyc - Working through the linked issues :)

I'd say we should do a build for PHP 5.6 at least, maybe on Ubuntu 14.04 (or 16.04 if it's easier), since that will be an LTS we should support for a while.

@geerlingguy
Copy link
Owner

Also, as a note—I think I'd be okay with some 7.1 failures (and some failures switching versions here and there), and we can call the 'version switching' an experimental feature for now. Best option is to always destroy and rebuild (like we always have done), but you can try switching PHP versions on the fly if you want... something to that effect.

Looks like you've already updated docs, and everything else I'm seeing looks wonderful. Plus, even if not switching on-the-fly, having the Version be a variable (by using Ondrej's repo in all cases) is quite a slick feature!

Thanks for the work on this! After I kick the tires a tiny bit more, I'm planning on merging tonight.

🚂 All aboard the release train!

@oxyc
Copy link
Collaborator Author

oxyc commented Dec 10, 2016

Let me run a few more tests as well! I'll try and get 12.04 with redis as well as php 7.1 with xdebug working tonight.

@geerlingguy
Copy link
Owner

@oxyc - I'm all for it—you're on a roll, I don't think I want to slow you down :)

Just give me the 👍 when you're ready for me to merge this (I'm running a couple builds now).

@oxyc oxyc force-pushed the phpv2 branch 2 times, most recently from c33fcf9 to b9a8353 Compare December 10, 2016 04:06
@oxyc
Copy link
Collaborator Author

oxyc commented Dec 10, 2016

2.4mbit connection is slooooooooooow....

@oxyc
Copy link
Collaborator Author

oxyc commented Dec 10, 2016

@geerlingguy geerlingguy/ansible-role-php-redis#2 fixed Ubuntu 12.04 for me. It runs with PHP 7.1 and redis. Let's just wait for travis to get back and then this gets my 👍

Only feature which doesn't work is XHProf on 7.1

@oxyc oxyc changed the title [WIP] Followup #667, #714: Make it easier to switch between PHP versions Followup #667, #714: Make it easier to switch between PHP versions Dec 10, 2016
@oxyc
Copy link
Collaborator Author

oxyc commented Dec 10, 2016

That's just awesome! Thanks @thom8 for all your work on this.

@geerlingguy
Copy link
Owner

php-redis role is happy and now part of Drupal VM. Running through code one last time to make sure there's nothing major we're missing...

@geerlingguy
Copy link
Owner

Thanks to both @thom8 and @oxyc — I don't think I would've ever taken the time to get this working so nicely...

You guys deserve a lot of 🍻 !


Ondřej Surý's PPA for PHP is used to install PHP 7.0, but you can switch to using 5.6 or 7.1 packages by changing `php_version` inside `config.yml` to eg. `"7.1"`.

If you're using Apache with `mod_php` you should also add `libapache2-mod-php7.1` to the `extra_packages` list.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to specify what to do for PHP 5.6 too—or reword this so it is less 7.1-specific.

@@ -4,38 +4,6 @@ vagrant_box: geerlingguy/ubuntu1204

# Acquia Cloud defaults to PHP 5.6.
php_version: "5.6"
php_install_recommends: no
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to self—I'll need to update BLT's internal config.yml once this stuff lands.

@geerlingguy geerlingguy merged commit d9f53eb into geerlingguy:master Dec 10, 2016
@geerlingguy
Copy link
Owner

MERGED!

@geerlingguy
Copy link
Owner

Now, to retest things a couple more times... I'll either tag 4.0.0 tomorrow sometime (I have a car inspection scheduled...), or on Monday when I'm prepping for a trip to Baltimore.

This one's getting a Twitter mention, a Blog post, the whole nine yards!

@geerlingguy geerlingguy added this to the 3.6.0 milestone Dec 10, 2016
@sbubaron
Copy link

FYI After switching to 5.6 from 7 I was getting the error:

Failed loading /usr/lib/php5/modules/xdebug.so:  /usr/lib/php5/modules/xdebug.so: undefined symbol: zend_sort

A vagrant destroy and a vagrant up fixed it. Might want to add that to the docs and maybe change the release notes so that it doesn't imply you can just provision.

Also the URL in default.config.vm docs is broken:
To use 5.6, see: http://docs.drupalvm.com/en/latest/other/php-56/ should be http://docs.drupalvm.com/en/latest/other/php/

Finally, I had previously specified the following php_packages in my config.yml (I don't remember why, I imagine I copied them from default.config.yml at somepoint) -- are these no longer needed in Drupal-VM 4.0? Or should I update them to reference the php5.6 versions?

php_packages:
  - php7.0-common
  - php7.0-cli
  - php7.0-dev
  - php7.0-fpm
  - libpcre3-dev
  - php7.0-gd
  - php7.0-curl
  - php7.0-imap
  - php7.0-json
  - php7.0-opcache
  - php7.0-xml
  - php7.0-mbstring
  - php-sqlite3
  - php-apcu
  - php7.0-mcrypt

@oxyc
Copy link
Collaborator Author

oxyc commented Dec 22, 2016

Failed loading /usr/lib/php5/modules/xdebug.so: /usr/lib/php5/modules/xdebug.so: undefined symbol: zend_sort

I had this at some point but couldn't reproduce it so I thought it was fixed somehow. Might be related and fixable now that geerlingguy/ansible-role-php-xdebug#32 geerlingguy/ansible-role-php-xhprof#16 are merged. Would you mind creating a separate issue?

Also the URL in default.config.vm docs is broken:
To use 5.6, see: http://docs.drupalvm.com/en/latest/other/php-56/ should be http://docs.drupalvm.com/en/latest/other/php/

This is already fixed in master. c626a3e

Finally, I had previously specified the following php_packages in my config.yml (I don't remember why, I imagine I copied them from default.config.yml at somepoint) -- are these no longer needed in Drupal-VM 4.0? Or should I update them to reference the php5.6 versions?

  • libpcre3-dev is a dependency of php*-dev so doesn't need to be specified. I excluded it so it's easier to purge the packages.
  • php-sqlite3, php-apcu are found using php7.0-* as well.
  • The others haven't changed.

You don't need to specify them.

@oxyc oxyc deleted the phpv2 branch April 24, 2017 16:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants