4
respostas

Erro ao instalar o php5

Fala pessoal, blz ?

Estou com problema em instalar o php5, alguem poderia me ajudar ?

Quando rodo o comando: "ansible-playbook provisioning.yml -u vagrant -i hosts --private-key id_rsa "

Ele mostra o erro: fatal: [192.168.0.50]: FAILED! => {"cache_update_time": 1656945429, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'php5=5.5.9+dfsg-1ubuntu4.29+esm15'' failed: E: Unable to correct problems, you have held broken packages.\n", "rc": 100, "stderr": "E: Unable to correct problems, you have held broken packages.\n", "stderr_lines": ["E: Unable to correct problems, you have held broken packages."], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nSome packages could not be installed. This may mean that you have\nrequested an impossible situation or if you are using the unstable\ndistribution that some required packages have not yet been created\nor been moved out of Incoming.\nThe following information may help to resolve the situation:\n\nThe following packages have unmet dependencies:\n php5 : Depends: libapache2-mod-php5 (>= 5.5.9+dfsg-1ubuntu4.29+esm15) but 5.5.9+dfsg-1ubuntu4.29 is to be installed or\n libapache2-mod-php5filter (>= 5.5.9+dfsg-1ubuntu4.29+esm15) but it is not going to be installed or\n php5-cgi (>= 5.5.9+dfsg-1ubuntu4.29+esm15) but 5.5.9+dfsg-1ubuntu4.29 is to be installed or\n php5-fpm (>= 5.5.9+dfsg-1ubuntu4.29+esm15) but 5.5.9+dfsg-1ubuntu4.29 is to be installed\n Depends: php5-common (>= 5.5.9+dfsg-1ubuntu4.29+esm15) but 5.5.9+dfsg-1ubuntu4.29 is to be installed\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "Some packages could not be installed. This may mean that you have", "requested an impossible situation or if you are using the unstable", "distribution that some required packages have not yet been created", "or been moved out of Incoming.", "The following information may help to resolve the situation:", "", "The following packages have unmet dependencies:", " php5 : Depends: libapache2-mod-php5 (>= 5.5.9+dfsg-1ubuntu4.29+esm15) but 5.5.9+dfsg-1ubuntu4.29 is to be installed or", " libapache2-mod-php5filter (>= 5.5.9+dfsg-1ubuntu4.29+esm15) but it is not going to be installed or", " php5-cgi (>= 5.5.9+dfsg-1ubuntu4.29+esm15) but 5.5.9+dfsg-1ubuntu4.29 is to be installed or", " php5-fpm (>= 5.5.9+dfsg-1ubuntu4.29+esm15) but 5.5.9+dfsg-1ubuntu4.29 is to be installed", " Depends: php5-common (>= 5.5.9+dfsg-1ubuntu4.29+esm15) but 5.5.9+dfsg-1ubuntu4.29 is to be installed"]}

Aqui esta meu arquivo .yml arquivo

Aqui esta meu arquivo Vagrantfilevagrant

4 respostas

Olá Rodrigo,

Cara, acho q um teste válido seria acessar a máquina linux, e tentar localizar o php5 direto pelo APT com o comando:

sudo apt search php

Se não encontrar, só substituir pela versão php existente. Aqui no meu caso eu fui para a versão 7.4, por ter usado o Ubuntu Focal ao invés do Trusty.

Olá Hugo,

Fiz como você falou e consegui instalar a versão 7.4, porém não estou conseguindo instalar o php-fpm, você conseguiu instalar ou não foi necessário?

Obrigado!

Olá Denis,

para a proposta do exercício, eu acabei nem levando em consideração todos os pacotes. Mas procurando aqui com o comando abaixo, achei as seguintes versões:

vagrant@ubuntu-focal:~$ sudo apt search php | grep fpm

php-fpm/focal 2:7.4+75 all
php7.4-fpm/focal-updates,focal-security 7.4.3-4ubuntu2.12 amd64

Então se vc conseguiu instalar o php7.4, acredito que o fpm seria php7.4-fpm:

sudo apt install php7.4-fpm

Acho q vai dar bom!

Valeu

Obrigado Hugo!

Fiz aqui e funcionou depois de rodar um update na máquina.

vagrant@wordpress2:~$ sudo apt-get update

E depois rodar o comando ansible-playbook:

comando ansible-playbookcomando para encontrar o php-fm