Preciso atualizar meu PHP para última versão, porém não estou conseguindo, atualmente ele está na versão 5.5.9, gostaria de deixa-lo na última versão, para assim eu conseguir instalar o Laravel.
Eu tentei usar o comando php7 apt-get mas deu erro.
- Como faço para desistalar o PHP 5.5.9
- Como faço para instalar o PHP 7.3 + ?
Obs: Eu estou querendo atualizar, por que de acordo com esse vídeo (https://www.youtube.com/watch?v=iPTxznidNHo&list=PLVSNL1PHDWvR3PeLXz6nvBkDhv1IQk4wP) ele deixa a versão mais recente, porém quando vou pegar no github dele a instalação vem com a versão antiga do PHP.
Edit: Usei o comando sudo apt install php7.3
e deu essa seguinte mensagem:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.3
E: Couldn't find any package by regex 'php7.3'
Depois utilizo o comando sudo update-alternatives --set php /usr/bin/php7.2
e o resultado é:
update-alternatives: error: alternative /usr/bin/php7.2 for php not registered; not setting
Tentei reiniciar o Apache2 para verificar se foi, porém sem sucesso.
Edit2: Executei o Comando: sudo apt update && apt upgrade
e retornou:
Hit http://ppa.launchpad.net trusty InRelease
Ign http://archive.ubuntu.com trusty InRelease
Hit http://security.ubuntu.com trusty-security InRelease
Hit http://archive.ubuntu.com trusty-updates InRelease
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://archive.ubuntu.com trusty-backports InRelease
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://archive.ubuntu.com trusty Release.gpg
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/main Sources
Hit http://ppa.launchpad.net trusty/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/restricted Sources
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://archive.ubuntu.com trusty-updates/universe Sources
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://archive.ubuntu.com trusty-updates/multiverse Sources
Hit http://archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/universe amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/multiverse amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/main Translation-en
Hit http://archive.ubuntu.com trusty-updates/multiverse Translation-en
Hit http://archive.ubuntu.com trusty-updates/restricted Translation-en
Hit http://archive.ubuntu.com trusty-updates/universe Translation-en
Hit http://archive.ubuntu.com trusty-backports/main Sources
Hit http://archive.ubuntu.com trusty-backports/restricted Sources
Hit http://archive.ubuntu.com trusty-backports/universe Sources
Hit http://archive.ubuntu.com trusty-backports/multiverse Sources
Hit http://archive.ubuntu.com trusty-backports/main amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/universe amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/multiverse amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/main Translation-en
Hit http://archive.ubuntu.com trusty-backports/multiverse Translation-en
Hit http://archive.ubuntu.com trusty-backports/restricted Translation-en
Hit http://archive.ubuntu.com trusty-backports/universe Translation-en
Hit http://archive.ubuntu.com trusty Release
Hit http://archive.ubuntu.com trusty/main Sources
Hit http://archive.ubuntu.com trusty/restricted Sources
Hit http://archive.ubuntu.com trusty/universe Sources
Hit http://archive.ubuntu.com trusty/multiverse Sources
Hit http://archive.ubuntu.com trusty/main amd64 Packages
Hit http://archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty/universe amd64 Packages
Hit http://archive.ubuntu.com trusty/multiverse amd64 Packages
Hit http://archive.ubuntu.com trusty/main Translation-en
Hit http://archive.ubuntu.com trusty/multiverse Translation-en
Hit http://archive.ubuntu.com trusty/restricted Translation-en
Hit http://archive.ubuntu.com trusty/universe Translation-en
Ign http://archive.ubuntu.com trusty/main Translation-en_US
Ign http://archive.ubuntu.com trusty/multiverse Translation-en_US
Ign http://archive.ubuntu.com trusty/restricted Translation-en_US
Ign http://archive.ubuntu.com trusty/universe Translation-en_US
Reading package lists... Done
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) // -> Não tenho permissão?!
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Após não ter sucessão eu executei os demais comandos:
sudo add-apt-repository ppa:ondrej/php
Retorno:
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.
Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa
You can get more information about the packages at https://deb.sury.org
BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting
CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advise to add ppa:ondrej/nginx-mainline
or ppa:ondrej/nginx
PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/
WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:
# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmpdyam2xwj/secring.gpg' created
gpg: keyring `/tmp/tmpdyam2xwj/pubring.gpg' created
gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpdyam2xwj/trustdb.gpg: trustdb created
gpg: key E5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Após todo esse processo, executei o último comando que restava:
sudo apt install php7.3 php7.3-cli php7.3-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.3
E: Couldn't find any package by regex 'php7.3'
E: Unable to locate package php7.3-cli
E: Couldn't find any package by regex 'php7.3-cli'
E: Unable to locate package php7.3-common
E: Couldn't find any package by regex 'php7.3-common'
Porém não houve nenhuma sucessão dos comandos...
sudo apt install php7.3
, depois altera pra começar a usar essa nova versão comsudo update-alternatives --set php /usr/bin/php7.2
, pra finaliza reinicia o servidor se tiver usando apache2 execudasudo service apache2 restart
– fajuchem 16/05/19 às 20:49sudo apt update && apt upgrade
,sudo add-apt-repository ppa:ondrej/php
,sudo update
,sudo apt install php7.3 php7.3-cli php7.3-common
e dai executasudo update-alternatives --set php /usr/bin/php7.3
– fajuchem 16/05/19 às 21:01