geerlingguy / ansible-role-php

Ansible Role - PHP
https://galaxy.ansible.com/geerlingguy/php/
MIT License
492 stars 442 forks source link

Two versions of php are installed #357

Closed justas147 closed 2 years ago

justas147 commented 2 years ago

When I set php_default_version_debian variable to install version 7.3 php 8.1 is also installed and gets set as the main version for php command. Does this suppose to happen or have I missed something?

image

racke commented 2 years ago

Which distribution do you use on the target host?

justas147 commented 2 years ago

Which distribution do you use on the target host?

Ubuntu 20

tarantegui commented 2 years ago

It is also happening to me in Ubuntu 18. My variable sets the version to 8.0 and a few days ago it was installing 8.0.14 and now is installing 8.1.2. Any idea to solve that?

justas147 commented 2 years ago

I included a task to set the default php version after:

- name: Select default php version
  become: true
  alternatives:
    name: php
    path: "/usr/bin/php{{ php_default_version_debian }}"
geerlingguy commented 2 years ago

This is also happening to me on my servers, and in some other projects, e.g.:

geerlingguy commented 2 years ago

It looks like the issue may be that php-apcu needs to actually become php{{ php_default_version_debian }}-apcu at least on Debian 11 or other recent OS releases...

See: https://github.com/geerlingguy/ansible-role-php/blob/4bf651a5c4abb8264003cc943ebf82b2d1af2ba8/vars/Debian.yml#L18

geerlingguy commented 2 years ago

Looks like also maybe php-sqlite3 is a problem.

geerlingguy commented 2 years ago

Also noting that the command to revert to a known good PHP version on an existing server is:

sudo update-alternatives --set php /usr/bin/php7.4

(if you don't want to automate it in the playbook... replace the PHP version number with the one you have installed).