非IT企業に勤める中年サラリーマンのIT日記

非IT企業でしかもITとは全く関係ない部署にいる中年エンジニア。唯一の趣味がプログラミングという”自称”プログラマー。

UbuntuにPHP最新版をインストールする方法

   

PHPのリポジトリを登録
$ sudo apt install software-properties-common
$ sudo apt-add-repository ppa:ondrej/php
$ sudo apt update
 

 

最新版パッケージの確認
$ sudo apt show php7.4
 Package: php7.4
Version: 7.4.29-1+ubuntu21.10.1+deb.sury.org+1
Priority: optional
Section: php
Maintainer: Debian PHP Maintainers <team+pkg-php@tracker.debian.org>
Installed-Size: 86.0 kB
Provides: php
Depends: libapache2-mod-php7.4 | php7.4-fpm | php7.4-cgi, php7.4-common
Download-Size: 50.0 kB
APT-Sources: http://ppa.launchpad.net/ondrej/php/ubuntu impish/main amd64 Packages
Description: server-side, HTML-embedded scripting language (metapackage)
 This package is a metapackage that, when installed, guarantees that you
 have at least one of the four server-side versions of the PHP interpreter
 installed. Removing this package won't remove PHP from your system, however
 it may remove other packages that depend on this one.
 .
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.
 

 

PHPのインストール
$ sudo apt install php7.4
 

 

バージョン確認
$ php -v
PHP 7.4.29 (cli) (built: Apr 21 2022 10:16:53) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.29, Copyright (c), by Zend Technologies
 

 

スポンサーリンク

 - PHP