drupal-vm icon indicating copy to clipboard operation
drupal-vm copied to clipboard

PHP 5.6 documentation

Open glassdimly opened this issue 10 years ago • 13 comments

Hello!

I'm working to install php 5.6 and I'm having some trouble.

==> drupalvm: TASK [geerlingguy.php : Ensure PHP packages are installed.] ********************
==> drupalvm: failed: [localhost] (item=[u'php5', u'php5-mcrypt', u'php5-cli', u'php5-common', u'php5-curl', u'php5-dev', u'php5-fpm', u'php5-gd', u'php5-sqlite', u'php-pear', u'libpcre3-dev']) => {"failed": true, "item": ["php5", "php5-mcrypt", "php5-cli", "php5-common", "php5-curl", "php5-dev", "php5-fpm", "php5-gd", "php5-sqlite", "php-pear", "libpcre3-dev"], "msg": "No package matching 'php5' is available"}
==> drupalvm:   to retry, use: --limit @/vagrant/provisioning/playbook.retry

I have copied the settings directly from the docs and/or the acquia config.yaml file:


php_version: "5.6"
php_memory_limit: "192M"
php_display_errors: "On"
php_display_startup_errors: "On"
php_realpath_cache_size: "1024K"
php_sendmail_path: "/opt/mailhog/mhsendmail"
php_opcache_enabled_in_ini: true
php_opcache_memory_consumption: "192"
php_opcache_max_accelerated_files: 4096
php_max_input_vars: "4000"
php_packages:
  - php5
  - php5-mcrypt
  - php5-cli
  - php5-common
  - php5-curl
  - php5-dev
  - php5-fpm
  - php5-gd
  - php5-sqlite
  - php-pear
  - libpcre3-dev
php_conf_paths:
  - /etc/php5/fpm
  - /etc/php5/apache2
  - /etc/php5/cli
php_extension_conf_paths:
  - /etc/php5/fpm/conf.d
  - /etc/php5/apache2/conf.d
  - /etc/php5/cli/conf.d
php_fpm_daemon: php5-fpm
php_fpm_conf_path: "/etc/php5/fpm"
php_fpm_pool_conf_path: "/etc/php5/fpm/pool.d/www.conf"
php_mysql_package: php5-mysql

And I've tried using php5.6 instead of php5, i.e. php5.6-curl instead of php5-curl. I have also tried moving to the preferred repo.

- name: Add repository for PHP 5.6.
  apt_repository: repo='ppa:ondrej/php'
  when: php_version == "5.6" and ansible_distribution == "Ubuntu" and ansible_distribution_version != "16.04"

Any help appreciated. I'll update this thread when I have a solution.

glassdimly avatar Jul 08 '16 19:07 glassdimly

@glassdimly - At this time, you also need to switch the vagrant_box to geerlingguy/ubuntu1404 (or any other option besides Ubuntu 16.04), because 16.04 only includes PHP 7.0+ in it's repositories.

After doing that, do a vagrant destroy then vagrant up again and things should work.

geerlingguy avatar Jul 08 '16 19:07 geerlingguy

So in this case is this a task to fix/remove php 5.6 from the documentation? Or is this a ticket to add php5.6 support?

glassdimly avatar Jul 08 '16 20:07 glassdimly

So in actuality the error here is is that the following ansible stanza is failing to add ondrej's repo (which I have modified be be the new repo rather than the old):

- name: Add repository for PHP 5.6.
  apt_repository: repo='ppa:ondrej/php'
  when: php_version == "5.6" and ansible_distribution == "Ubuntu" and ansible_distribution_version != "16.04"

After provisioning:

vagrant@drupalvm:~$ sudo apt-get update
Hit:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [94.5 kB]                  
Hit:3 http://ppa.launchpad.net/ansible/ansible/ubuntu xenial InRelease                                                                 
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [92.2 kB]                                                         
Get:5 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]                           
Hit:6 https://deb.nodesource.com/node_0.12 xenial InRelease   
Get:7 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [248 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [244 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [152 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [149 kB]
Fetched 1,073 kB in 7s (147 kB/s)                                                                                                                                                
Reading package lists... Done
vagrant@drupalvm:

After manual add:

vagrant@drupalvm:~$ sudo apt-add-repository ppa:ondrej/php
sudo apt-add-repository ppa:ondrej/php
<-snip->
vagrant@drupalvm:~$ sudo apt-get update

Get:5 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease [23.9 kB]                                     
<-snip->
Get:8 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages [44.3 kB]
Get:9 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main i386 Packages [44.4 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [248 kB]
Get:11 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main Translation-en [24.4 kB]        
<-snip->
Fetched 1,210 kB in 5s (228 kB/s)                                                     
Reading package lists... Done
vagrant@drupalvm:~$

glassdimly avatar Jul 08 '16 20:07 glassdimly

@glassdimly from this point forward, PHP 7.0+ will be the default/supported version of PHP for Drupal VM (5.6 will end active support in December this year): http://php.net/supported-versions.php

The documentation page for running PHP 5.6 contains all the required changes to get Drupal VM to install/configure PHP 5.6 correctly on this page: http://docs.drupalvm.com/en/latest/other/php-56/

And there's also a PR that may enable easier PHP version switching (inside an already-built VM): https://github.com/geerlingguy/drupal-vm/pull/714 (note that this is already possible, just not super-easy/documented right now, using the existing version of Drupal VM).

What's the current OS release/version of your VM? (Run lsb_release -a)

geerlingguy avatar Jul 08 '16 20:07 geerlingguy

Thanks for your help @geerlingguy, and thanks for contributing this excellent virtual machine.

vagrant@drupalvm:~$ lsb_release -a       
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04 LTS
Release:    16.04
Codename:   xenial
vagrant@drupalvm:~$ 

So will Drupal 7 actually run on PHP 7? My reading of some of the parser changes seemed to indicate "no." Am I wrong?

As to your other repo, are you referring to https://github.com/geerlingguy/packer-ubuntu-1404 ?

glassdimly avatar Jul 08 '16 21:07 glassdimly

@glassdimly — no, you need to add to your config.yml file (along with the php_ changes) the following line:

vagrant_box: geerlingguy/ubuntu1404

Then run vagrant destroy to completely delete Drupal VM. Then run vagrant up again to rebuild it using Ubuntu 14.04. PHP 5.6 is not supported on Ubuntu 16.04 at this time, so you have to switch the base box before running vagrant up.

And yes, PHP 7 and Drupal 7 (especially 7.50+) work great together—I'm currently running www.jeffgeerling.com and a number of other sites on it, and outside of some notices generated by Ctools (which will be fixed soon), there's no issue—just way faster page loads and more modern language features I can use :)

See: Fully support PHP 7 in Drupal 7

Note that some contributed modules (especially ones that are less widely-used and less frequently updated) may have unforseen PHP 7.x bugs.

geerlingguy avatar Jul 08 '16 21:07 geerlingguy

Oh wow, just caught my mistake. Yes, you're right. Thanks for your help.

glassdimly avatar Jul 08 '16 21:07 glassdimly

No problem! But look into upgrading to PHP 7 when you can... it's really a nice speed bump!

geerlingguy avatar Jul 08 '16 21:07 geerlingguy

Next project. Budget too cramped on this one, too many devs with too many environments. But now that I am getting my head around ansible...

glassdimly avatar Jul 08 '16 21:07 glassdimly

@glassdimly - Check out Ansible for DevOps if you haven't already... I know the author :)

geerlingguy avatar Jul 08 '16 21:07 geerlingguy

Indeed, I ordered it already!

glassdimly avatar Jul 09 '16 02:07 glassdimly

this page is not opening:

http://docs.drupalvm.com/en/latest/other/php-56/

jatingarg1989 avatar Jul 17 '17 09:07 jatingarg1989

@jatingarg1989 - That's probably from a pretty old link; there isn't a PHP 5.6-specific page anymore, but a page that goes over all the version information for any PHP version: http://docs.drupalvm.com/en/latest/configurations/php/

With all other defaults, all you need to do now to switch to 5.6 is set that as the php_version in your config.yml.

geerlingguy avatar Jul 23 '17 19:07 geerlingguy