수색…


PHP 7 용 APT를 사용한 명령 행 설치

이렇게하면 PHP 만 설치됩니다. 웹에 PHP 파일을 제공하려면 Apache , Nginx 와 같은 웹 서버를 설치하거나 PHP의 웹 서버 ( PHP 버전 5.4 이상 )를 사용해야 합니다.

16.04 이하의 우분투 버전에 PHP 7을 사용하고 싶다면 다음을 수행하여 Ondrej의 PPA 저장소 를 추가 할 수 있습니다 : sudo add-apt-repository ppa:ondrej/php

모든 리포지토리 가 최신 상태인지 확인하십시오.

sudo apt-get update

시스템의 저장소를 업데이트 한 후 PHP를 설치하십시오 :

sudo apt-get install php7.0

PHP 버전을 확인하여 설치를 테스트 해보자.

php --version

이 같은 출력해야합니다.

참고 : 출력물은 약간 다릅니다.

PHP 7.0.8-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.8-0ubuntu0.16.04.1, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans

이제 명령 행에서 PHP를 실행할 수 있습니다.

Enterprise Linux 배포판에 설치 (CentOS, Scientific Linux 등)

Enterprise Linux 기반 운영 체제에서 yum 명령을 사용하여 패키지를 관리합니다.

yum install php

이것은 몇 가지 일반적인 기능을 포함하여 PHP의 최소 설치를 설치합니다. 추가 모듈이 필요하면 별도로 설치해야합니다. 다시 한번 yum 을 사용하여 다음 패키지를 검색 할 수 있습니다.

yum search php-*

예제 출력 :

php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php-cli.x86_64 : Command-line interface for PHP
php-common.x86_64 : Common files for PHP
php-dba.x86_64 : A database abstraction layer module for PHP applications
php-devel.x86_64 : Files needed for building PHP extensions
php-embedded.x86_64 : PHP library for embedding in applications
php-enchant.x86_64 : Human Language and Character Encoding Support
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-imap.x86_64 : A module for PHP applications that use IMAP

gd 라이브러리를 설치하려면 다음을 수행하십시오.

yum install php-gd

Enterprise Linux 배포판은 항상 업데이트로 인해 보수적이었으며 일반적으로 함께 제공되는 포인트 릴리스 이상으로 업데이트되지 않습니다. 많은 써드 파티 리포지토리가 PHP의 최신 버전을 제공합니다 :

IUS와 Webtatic은 php56u 의 저장소가 시스템 패키지와 동일한 이름을 사용하여 현재 위치 업그레이드를 제공하는 반면 다른 이름을 가진 대체 패키지 (예 : php56u 또는 php56w )를 제공합니다.

다음은 Remi의 저장소에서 PHP 7.0을 설치하는 방법입니다. 이것은 시스템 패키지를 제거 할 필요가 없기 때문에 가장 간단한 예입니다.

# download the RPMs; replace 6 with 7 in case of EL 7
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
# install the repository information
rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm
# enable the repository
yum-config-manager --enable epel --enable remi --enable remi-safe --enable remi-php70
# install the new version of PHP
# NOTE: if you already have the system package installed, this will update it
yum install php


Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow