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

My DrupalVM has started using 7.2b1 for Drush, on which it fails #1498

Closed
svenbergryen opened this issue Aug 2, 2017 · 13 comments
Closed

My DrupalVM has started using 7.2b1 for Drush, on which it fails #1498

svenbergryen opened this issue Aug 2, 2017 · 13 comments
Labels

Comments

@svenbergryen
Copy link

svenbergryen commented Aug 2, 2017

Issue Type

  • Bug Report / Support Request

Your Environment

Vagrant 1.9.7
VirtualBox 5.1.26r117224
ansible 2.2.1.0
  config file = 
  configured module search path = Default w/o overrides

Your OS

  • macOS (10.13)

Full console output

When running just drush, I get many lines with the following notice:

count(): Parameter must be an array or an object that implements Countable Table.php:789                                                                                                                                                                           [warning]

Running a specific drush command inside a drupal site gives me this:

root@drupalvm:/client# drush
PHP Fatal error:  Uncaught Error: Call to undefined function cache_get() in /client/includes/module.inc:754
Stack trace:
#0 /client/includes/module.inc(954): module_implements('system_theme_in...')
#1 /client/modules/system/system.module(2511): module_invoke_all('system_theme_in...')
#2 /client/includes/theme.inc(798): _system_rebuild_theme_data()
#3 /client/includes/theme.maintenance.inc(57): list_themes()
#4 /client/includes/bootstrap.inc(2857): _drupal_maintenance_theme()
#5 /client/includes/errors.inc(179): drupal_maintenance_theme()
#6 /client/includes/bootstrap.inc(2594): _drupal_log_error(Array, true)
#7 [internal function]: _drupal_exception_handler(Object(Error))
#8 {main}
  thrown in /client/includes/module.inc on line 754
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                                                                                                 [error]
Error: Uncaught Error: Call to undefined function cache_get() in /client/includes/module.inc:754
Stack trace:
#0 /client/includes/module.inc(954): module_implements('system_theme_in...')
#1 /client/modules/system/system.module(2511): module_invoke_all('system_theme_in...')
#2 /client/includes/theme.inc(798): _system_rebuild_theme_data()
#3 /client/includes/theme.maintenance.inc(57): list_themes()
#4 /client/includes/bootstrap.inc(2857): _drupal_maintenance_theme()
#5 /client/includes/errors.inc(179): drupal_maintenance_theme()
#6 /client/includes/bootstrap.inc(2594): _drupal_log_error(Array, true)
#7 [internal function]: _drupal_exception_handler(Object(Error))
#8 {main}
  thrown in /client/includes/module.inc, line 754

Summary

After provisioning my DrupalVM today, Drush started failing on me. On further inspection, it seems to be running on php 7.2.0beta1. (Build date Jul 27 2017 11:58:52). I didn't do anything in particular to get this installed, so I'm wondering if others will see this issue as well. Maybe it was running perfectly fine on php7.1 before?

I was able to determine that PHP-FPM still runs off /usr/sbin/php-fpm5.6, but I couldn't find any cli v5.6. I was thinking of doing something like DRUSH_PHP=/path/to/php-cli drush, but no cli seems to be available any longer.

@svenbergryen
Copy link
Author

UPDATE: As a workaround, I'm able to run drush like this /usr/bin/php5.6 /usr/local/bin/drush (I found the cli :) ) . I actually have no idea which version of php drush was running on before, since I never checked.

@geerlingguy
Copy link
Owner

@svenbergryen - It seems the problem is that maybe one of the PHP packages that's being installed is not PHP 5.6-specific, therefore it triggers an install of the beta version of PHP 7.2?

By default, Drupal VM would only install 7.1; can you show what config.yml changes you have to make sure 5.6 is installed? Especially any extra packages (php or otherwise)?

Also, hi!

@svenbergryen
Copy link
Author

Hi! :) I might at some point have had this in the config.yml:

php_packages:
  - php-zip

(I wasn't aware it was supposed to be php_packages_extra, and I also left out the version number at first.)

Is there a way to get out of it now that I've managed to get 7.2 into the box, or should I just destroy it?

Another workaround was to do a ln -s /usr/bin/php7.1 /usr/bin/php

Here's my current config.yml:

---
# `vagrant_box` can also be set to geerlingguy/centos6, geerlingguy/centos7,
# geerlingguy/debian8, geerlingguy/ubuntu1404, geerlingguy/ubuntu1204, etc.
vagrant_box: geerlingguy/ubuntu1604
vagrant_user: vagrant
vagrant_synced_folder_default_type: nfs
vagrant_gui: false

# If you need to run multiple instances of Drupal VM, set a unique hostname,
# machine name, and IP address for each instance.
vagrant_hostname: drupalvm.dev
vagrant_machine_name: drupalvm
vagrant_ip: 192.168.88.88

# Allow Drupal VM to be accessed via a public network interface on your host.
# Vagrant boxes are insecure by default, so be careful. You've been warned!
# See: https://docs.vagrantup.com/v2/networking/public_network.html
vagrant_public_ip: ""

# A list of synced folders, with the keys 'local_path', 'destination', and
# a 'type' of [nfs|rsync|smb] (leave empty for slow native shares). See
# http://docs.drupalvm.com/en/latest/getting-started/syncing-folders/ for more.
vagrant_synced_folders:
  # The first synced folder will be used for the default Drupal installation, if
  # any of the build_* settings are 'true'. By default the folder is set to
  # the drupal-vm folder.
  - local_path: /Webserver/eu8
    destination: /eu8
    id: eu8
    type: nfs
    create: true

# Memory and CPU to use for this VM.
vagrant_memory: 2048
vagrant_cpus: 1

# Ensure vagrant plugins are installed.
vagrant_plugins:
  - name: vagrant-vbguest
  - name: vagrant-hostsupdater

# Minimum required versions.
drupalvm_vagrant_version_min: '1.8.6'
drupalvm_ansible_version_min: '2.2'

# Force use of ansible_local provisioner, even if Ansible is installed on host.
force_ansible_local: false

# The web server software to use. Can be either 'apache' or 'nginx'.
drupalvm_webserver: apache

# The database system to use. Can be either 'mysql' or 'pgsql'.
drupal_db_backend: mysql

# Set this to 'false' if you are using a different site deployment strategy and
# would like to configure 'vagrant_synced_folders' and 'apache_vhosts' manually.
drupal_build_makefile: false
drush_makefile_path: "{{ config_dir }}/drupal.make.yml"
drush_make_options: "--no-gitinfofile"

# Set 'build_makefile' to 'false' and this to 'true' if you are using a
# composer based site deployment strategy.
drupal_build_composer: false
drupal_composer_path: "{{ config_dir }}/drupal.composer.json"
drupal_composer_install_dir: "/var/www/drupalvm/drupal"
drupal_composer_dependencies:
  - "drupal/devel:1.x-dev"

# Set this to 'true' and 'build_makefile', 'build_composer' to 'false' if you
# are using Composer's create-project as a site deployment strategy.
drupal_build_composer_project: true
drupal_composer_project_package: "drupal-composer/drupal-project:8.x-dev"
drupal_composer_project_options: "--prefer-dist --stability dev --no-interaction"

# Set this to 'false' if you don't need to install drupal (using the drupal_*
# settings below), but instead copy down a database (e.g. using drush sql-sync).
drupal_install_site: false

# Required Drupal settings.
drupal_core_path: "{{ drupal_composer_install_dir }}/web"
drupal_core_owner: "{{ drupalvm_user }}"
drupal_db_user: drupal
drupal_db_password: drupal
drupal_db_name: drupal

# Settings for installing a Drupal site if 'drupal_install_site:' is 'true'.
drupal_major_version: 8
drupal_domain: "{{ vagrant_hostname }}"
drupal_site_name: "Drupal"
drupal_install_profile: standard
drupal_enable_modules: [ 'devel' ]
drupal_account_name: admin
drupal_account_pass: admin

# Additional arguments or options to pass to `drush site-install`.
drupal_site_install_extra_args: []

# Cron jobs are added to the vagrant user's crontab. Keys include name
# (required), minute, hour, day, weekday, month, job (required), and state.
drupalvm_cron_jobs: []

# Drupal VM automatically creates a drush alias file in your ~/.drush folder if
# this variable is 'true'.
configure_drush_aliases: true
drush_aliases_host_template: "templates/drupalvm.aliases.drushrc.php.j2"
drush_aliases_guest_template: "templates/drupalvm-local.aliases.drushrc.php.j2"

# Helper variable to configure the PHP-FPM connection for each Apache
# VirtualHost in the `apache_vhosts` list.
apache_vhost_php_fpm_parameters: |
    <FilesMatch \.php$>
      SetHandler "proxy:fcgi://{{ php_fpm_listen }}"
    </FilesMatch>

# Apache VirtualHosts. Add one for each site you are running inside the VM. For
# multisite deployments, you can point multiple servernames at one documentroot.
# View the geerlingguy.apache Ansible Role README for more options.
apache_vhosts:
  - servername: "eu8.local.no"
    documentroot: "/eu8"
    extra_parameters: |
          ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000/eu8"

  - servername: "{{ drupal_domain }}"
    serveralias: "www.{{ drupal_domain }}"
    documentroot: "{{ drupal_core_path }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "adminer.{{ vagrant_hostname }}"
    documentroot: "{{ adminer_install_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "xhprof.{{ vagrant_hostname }}"
    documentroot: "{{ php_xhprof_html_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "pimpmylog.{{ vagrant_hostname }}"
    documentroot: "{{ pimpmylog_install_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  - servername: "{{ vagrant_ip }}"
    serveralias: "dashboard.{{ vagrant_hostname }}"
    documentroot: "{{ dashboard_install_dir }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

apache_listen_port: "81"
apache_packages_state: latest
apache_remove_default_vhost: true
apache_mods_enabled:
  - expires.load
  - ssl.load
  - rewrite.load
  - proxy.load
  - proxy_fcgi.load

# Nginx hosts. Each site will get a server entry using the configuration defined
# here. Set the 'is_php' property for document roots that contain PHP apps like
# Drupal.
nginx_hosts:
  - server_name: "{{ drupal_domain }} www.{{ drupal_domain }}"
    root: "{{ drupal_core_path }}"
    is_php: true

  - server_name: "adminer.{{ vagrant_hostname }}"
    root: "{{ adminer_install_dir }}"
    is_php: true

  - server_name: "xhprof.{{ vagrant_hostname }}"
    root: "{{ php_xhprof_html_dir }}"
    is_php: true

  - server_name: "pimpmylog.{{ vagrant_hostname }}"
    root: "{{ pimpmylog_install_dir }}"
    is_php: true

  - server_name: "{{ vagrant_ip }} dashboard.{{ vagrant_hostname }}"
    root: "{{ dashboard_install_dir }}"
    is_php: true

nginx_remove_default_vhost: true
nginx_ppa_use: true
nginx_vhost_template: "templates/nginx-vhost.conf.j2"

# MySQL databases and users.
mysql_databases:
  - name: "{{ drupal_db_name }}"
    encoding: utf8mb4
    collation: utf8mb4_general_ci

mysql_users:
  - name: "{{ drupal_db_user }}"
    host: "%"
    password: "{{ drupal_db_password }}"
    priv: "{{ drupal_db_name }}.*:ALL"

# PostgreSQL databases and users.
postgresql_databases:
  - name: "{{ drupal_db_name }}"

postgresql_users:
  - name: "{{ drupal_db_user }}"
    password: "{{ drupal_db_password }}"
    db: "{{ drupal_db_name }}"
    priv: "ALL"

# Comment out any extra utilities you don't want to install. If you don't want
# to install *any* extras, set this value to an empty set, e.g. `[]`.
installed_extras:
  - adminer
  # - blackfire
  - drupalconsole
  - drush
  # - elasticsearch
  # - java
  - mailhog
  # - memcached
  # - newrelic
  # - nodejs
  - pimpmylog
  - redis
  # - ruby
  # - selenium
  - solr
  # - tideways
  - upload-progress
  - varnish
  - xdebug
  - xhprof

# Add any extra apt or yum packages you would like installed.
extra_packages:
  - sqlite

# You can configure almost anything else on the server in the rest of this file.
drush_version: "8.1.11"

extra_security_enabled: false

firewall_enabled: true
firewall_allowed_tcp_ports:
  - "22"
  - "25"
  - "80"
  - "81"
  - "443"
  - "4444"
  - "8025"
  - "8080"
  - "8443"
  - "8983"
  - "9200"
firewall_log_dropped_packets: false
firewall_disable_firewalld: true
firewall_disable_ufw: true

# PHP Configuration. Currently-supported versions: 5.6, 7.0, 7.1.
# See version-specific notes: http://docs.drupalvm.com/en/latest/configurations/php/
php_version: "7.1"
php_install_recommends: no
php_memory_limit: "256M"
php_display_errors: "On"
php_display_startup_errors: "On"
php_error_log: "/var/log/php-scripts.log"
php_log_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_post_max_size: "500M"
php_upload_max_filesize: "500M"
php_mysql.connect_timeout: "6000"
php_error_reporting: "E_ALL & ~E_STRICT"
php_packages_extra:
  - php{{php_version}}-zip

# Drupal VM defaults to using PHP-FPM with either Apache or Nginx. If you wish
# to instead use Apache + mod_php with an Ubuntu base box, make sure you add
# libapache2-mod-php7.0 to `extra_packages` elsewhere in this config file.
php_enable_php_fpm: true
php_fpm_listen: "127.0.0.1:9000"

composer_path: /usr/bin/composer
composer_home_path: "/home/{{ drupalvm_user }}/.composer"
composer_home_owner: "{{ drupalvm_user }}"
composer_home_group: "{{ drupalvm_user }}"
composer_global_packages:
  - { name: hirak/prestissimo, release: '^0.3' }

# Run specified scripts before or after VM is provisioned. Path is relative to
# the `provisioning/playbook.yml` file.
pre_provision_scripts: []
post_provision_scripts: []
  # - "../examples/scripts/configure-solr.sh"

# MySQL Configuration.
mysql_root_password: root
mysql_slow_query_log_enabled: true
mysql_slow_query_time: 2
mysql_wait_timeout: 300
adminer_install_filename: index.php

# Node.js configuration (if enabled above).
# Valid examples: "0.10", "0.12", "4.x", "5.x", "6.x".
nodejs_version: "6.x"
nodejs_npm_global_packages: []
nodejs_install_npm_user: "{{ drupalvm_user }}"
npm_config_prefix: "/home/{{ drupalvm_user }}/.npm-global"

# Ruby Configuration (if enabled above).
ruby_install_gems_user: "{{ drupalvm_user }}"
ruby_install_gems: []

# Varnish Configuration (if enabled above).
varnish_listen_port: "80"
varnish_default_vcl_template_path: templates/drupalvm.vcl.j2
varnish_default_backend_host: "127.0.0.1"
varnish_default_backend_port: "81"

# Pimp my Log settings.
pimpmylog_install_dir: /usr/share/php/pimpmylog
pimpmylog_grant_all_privs: true

# XDebug configuration. XDebug is disabled by default for better performance.
php_xdebug_default_enable: 0
php_xdebug_coverage_enable: 0
php_xdebug_cli_enable: 1
php_xdebug_remote_enable: 1
php_xdebug_remote_connect_back: 1
# Use PHPSTORM for PHPStorm, sublime.xdebug for Sublime Text.
php_xdebug_idekey: PHPSTORM
php_xdebug_max_nesting_level: 256
php_xdebug_remote_host: "{{ ansible_default_ipv4.gateway }}"

# Solr Configuration (if enabled above).
solr_version: "3.6.2"
solr_xms: "64M"
solr_xmx: "128M"

# Selenium configuration.
selenium_version: 2.53.0

# Other configuration.
dashboard_install_dir: /var/www/dashboard
known_hosts_path: ~/.ssh/known_hosts
hostname_configure: true
hostname_fqdn: "{{ vagrant_hostname }}"
ssh_home: "{{ drupal_core_path }}"

@geerlingguy
Copy link
Owner

Yeah, if you can, it's probably best to just do a destroy and then up again, because it can be difficult to extract the installed version.

@geerlingguy
Copy link
Owner

Going to close this for now—please let me know if the issue persists after destroying and rebuilding the VM.

@wizonesolutions
Copy link
Contributor

Hello from the future — this can also happen if - tideways is uncommented in installed_extras. Commenting it out and commenting in - xhprof got me 5.6 back on the command line.

@jsfry
Copy link

jsfry commented Feb 19, 2018

I can confirm I am having this problem too - same error (PHP Fatal error: Uncaught Error: Call to undefined function cache_get() in /client/includes/module.inc:754) on an ubuntu 16.04 vps server at digital ocean running php7.2. I installed drush 8.1.10 using composer and "out of the box" it gave me this error on a clean drupal 7.56 install. I also have no idea what version of php drush is actually using from the command line or how to go about fixing it. It would be nice if the drush guys could address this and offer a solution.

@fubarhouse
Copy link

@jsfry

You can begin to look at solving this with some of the following:

  1. Are you using a global installation of drush, if so what version?
  2. Are you using drush launcher?
  3. If you are using drush as a composer dependency for your site, what version are you using?
  4. Are you able to provide a copy of defaults.config.yml and config.yml?
  5. Could you provide the output for git show where the DrupalVM repository lives?
  6. If you can, are you able to provide a copy of your composer.json file? (feel free to remove any references to private repositories).

This information will provide context for replication, but it should make the problem very obvious.

@jsfry
Copy link

jsfry commented Feb 20, 2018

ok, to be fair i've noticed that I have issues with different versions of php extensions on my server (some are 7.0 and some 7.2). I will resolve those and retest drush and report back

@lramarojaona
Copy link

lramarojaona commented Apr 4, 2018

Yeah, if you can, it's probably best to just do a destroy and then up again, because it can be difficult to extract the installed version.

@geerlingguy, is there a way to downgrade PHP without a destroy?

@geerlingguy
Copy link
Owner

@lramarojaona - Yeah, just update php_version to a different version, and run vagrant provision. It should just work.

@lramarojaona
Copy link

@geerlingguy, thank you for your answer, but that I know, I'm always playing with this as I have projects that need different PHP versions.
My question is really about PHP CLI, which is PHP 7.2 for some reason and this prevent using drush (at least for D7 projects).

@danepowell
Copy link
Contributor

I just encountered this problem. Turns out that it was due to the php-mysql extension being missing for the PHP CLI, which was running PHP 7.3 instead of PHP 7.1 as I had configured it. #1964

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants