Vagrant 没有加载正确的版本

Vagrant not loading the right versions

在我将我的 ansible 剧本 php 版本从 5 更新到 7.2 和 xdebug 以匹配该版本之后。 我 运行 php -v 在我的流浪者盒子里我得到

PHP 7.2.11-3+ubuntu14.04.1+deb.sury.org+1 (cli) (built: Oct 25 2018 08:20:21) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.11-3+ubuntu14.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans

但是我的phpinfo();

PHP Version 5.6.38-3+ubuntu14.04.1+deb.sury.org+1 This program makes use of the Zend Scripting Language Engine: 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 with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

我的剧本

---

 name: Add ppa Repository
  sudo: yes
  apt_repository: repo=ppa:ondrej/{{ php.ppa }}

- name: Update apt
  sudo: yes
  apt: update_cache=yes

- name: Install php72
  sudo: yes
  apt: pkg=php7.2 state=latest

- name: Install php72-fpm
  sudo: yes
  apt: pkg=php5-fpm state=latest

- name: Install PHP Packages
  sudo: yes
  apt: pkg={{ item }} state=latest
  with_items: "{{php.packages}}"
  when: php.packages is defined

- name: Set date.timezone for CLI
  become: true
  lineinfile:
    dest: /etc/php/7.2/cli/php.ini
    regexp: "date.timezone ="
    line: "date.timezone = Europe/Berlin"

- name: Set date.timezone for apache php
  become: true
  lineinfile:
    dest: /etc/php/7.2/apache2/php.ini
    regexp: "date.timezone ="
    line: "date.timezone = Europe/Berlin"

- include: configure.yml
- include: pecl.yml

这样做 php -v 会告诉您 php 您的 php CLI 运行 是哪个版本。因此 CLI 和 phpinfo 中的版本冲突。其次,任务'Install php72-fpm'上的'pkg'设置为'php5-fpm';尝试将其切换到您需要的版本,然后看看如何进行。