

AWS App Runner 는 2026년 4월 30일부터 신규 고객에게 더 이상 공개되지 않습니다. App Runner를 사용하려면 해당 날짜 이전에 가입하세요. 기존 고객은 정상적으로 서비스를 계속 이용할 수 있습니다. 자세한 내용은 [AWS App Runner 가용성 변경](https://docs.aws.amazon.com/apprunner/latest/dg/apprunner-availability-change.html)을 참조하세요.

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# PHP 플랫폼 사용
<a name="service-source-code-php"></a>

**중요**  
App Runner는 2025년 **12월 31일에 PHP 8.**1에 대한 지원을 종료합니다. 권장 사항 및 자세한 내용은 섹션을 참조하세요[관리형 런타임 버전에 대한 지원 종료](service-source-code.md#service-source-code.managed-platforms.eos).

 AWS App Runner PHP 플랫폼은 관리형 런타임을 제공합니다. 각 런타임을 사용하여 PHP 버전을 기반으로 웹 애플리케이션으로 컨테이너를 빌드하고 실행할 수 있습니다. PHP 런타임을 사용하는 경우 App Runner는 관리형 PHP 런타임 이미지로 시작합니다. 이 이미지는 [Amazon Linux Docker 이미지를](https://hub.docker.com/_/amazonlinux) 기반으로 하며 PHP 버전 및 일부 도구에 대한 런타임 패키지를 포함합니다. App Runner는이 관리형 런타임 이미지를 기본 이미지로 사용하고 애플리케이션 코드를 추가하여 도커 이미지를 빌드합니다. 그런 다음이 이미지를 배포하여 컨테이너에서 웹 서비스를 실행합니다.

 App Runner 콘솔 또는 [CreateService](https://docs.aws.amazon.com/apprunner/latest/api/API_CreateService.html) API 작업을 사용하여 서비스를 [생성할 때 App Runner 서비스에](manage-create.md) 대한 런타임을 지정합니다. 런타임을 소스 코드의 일부로 지정할 수도 있습니다. 코드 리포지토리에 포함하는 [App Runner 구성 파일의](config-file.md) `runtime` 키워드를 사용합니다. 관리형 런타임의 이름 지정 규칙은 *<language-name><major-version>*입니다.

유효한 PHP 런타임 이름 및 버전은 섹션을 참조하세요[PHP 런타임 릴리스 정보](service-source-code-php-releases.md).

App Runner는 모든 배포 또는 서비스 업데이트 시 서비스의 런타임을 최신 버전으로 업데이트합니다. 애플리케이션에 특정 버전의 관리형 런타임이 필요한 경우 [App Runner 구성 파일의](config-file.md) `runtime-version` 키워드를 사용하여 지정할 수 있습니다. 메이저 또는 마이너 버전을 포함하여 모든 수준의 버전으로를 잠글 수 있습니다. App Runner는 서비스의 런타임만 하위 수준으로 업데이트합니다.

PHP 런타임의 버전 구문: `major[.minor[.patch]]`

예: `8.1.10`

다음은 버전 잠금의 예입니다.
+ `8.1` - 메이저 및 마이너 버전을 잠급니다. App Runner는 패치 버전만 업데이트합니다.
+ `8.1.10` - 특정 패치 버전으로 잠급니다. App Runner는 런타임 버전을 업데이트하지 않습니다.

**중요**  
  기본 리포지토리 루트 [디렉터리 이외의 위치에서 App Runner 서비스의 코드 리포지토리 소스](service-source-code.md#service-source-code.source-directory) 디렉터리를 지정하려면 PHP 관리형 런타임 버전이 PHP `8.1.22` 이상이어야 합니다. 이전 PHP 런타임 버전은 기본 루트 소스 디렉터리만 사용할 `8.1.22` 수 있습니다.  

**Topics**
+ [PHP 런타임 구성](#service-source-code-php.config)
+ [호환성](#service-source-code-php.compatibility)
+ [PHP 런타임 예제](#service-source-code-php.examples)
+ [PHP 런타임 릴리스 정보](service-source-code-php-releases.md)

## PHP 런타임 구성
<a name="service-source-code-php.config"></a>

관리형 런타임을 선택할 때는 최소한 빌드 및 실행 명령도 구성해야 합니다. App Runner 서비스를 [생성](manage-create.md)하거나 [업데이트](manage-configure.md)하는 동안 이를 구성합니다. 다음 방법 중 하나를 사용하여이 작업을 수행할 수 있습니다.
+ **App Runner 콘솔 사용** - 생성 프로세스 또는 **구성 탭의 빌드** 구성 섹션에서 명령을 지정합니다.
+ **App Runner API 사용** - [CreateService](https://docs.aws.amazon.com/apprunner/latest/api/API_CreateService.html) 또는 [UpdateService](https://docs.aws.amazon.com/apprunner/latest/api/API_UpdateService.html) API 작업을 호출합니다. [CodeConfigurationValues](https://docs.aws.amazon.com/apprunner/latest/api/API_CodeConfigurationValues.html) 데이터 형식의 `BuildCommand` 및 `StartCommand` 멤버를 사용하여 명령을 지정합니다.
+ **[구성 파일](config-file.md) 사용** - 최대 3개의 빌드 단계에서 하나 이상의 빌드 명령을 지정하고 애플리케이션을 시작하는 데 사용되는 단일 실행 명령을 지정합니다. 추가 선택적 구성 설정이 있습니다.

구성 파일을 제공하는 것은 선택 사항입니다. 콘솔 또는 API를 사용하여 App Runner 서비스를 생성할 때 App Runner가 구성 설정을 생성할 때 직접 가져올지 또는 구성 파일에서 가져올지 지정합니다.

## 호환성
<a name="service-source-code-php.compatibility"></a>

다음 웹 서버 중 하나를 사용하여 PHP 플랫폼에서 App Runner 서비스를 실행할 수 있습니다.
+ Apache HTTP Server
+ NGINX

Apache HTTP Server 및 NGINX는 PHP-FPM과 호환됩니다. 다음 중 하나를 *NGINX* 사용하여 *Apache HTTP Server* 및를 시작할 수 있습니다.
+ [감독자](http://supervisord.org/introduction.html#supervisor-components/) - 실행에 대한 자세한 내용은 감독자 실행을 *supervisord*참조하세요. [http://supervisord.org/running.html#running-supervisord](http://supervisord.org/running.html#running-supervisord) 
+ 시작 스크립트 

*Apache HTTP Server* 또는 *NGINX*를 사용하여 PHP 플랫폼으로 App Runner 서비스를 구성하는 방법에 대한 예는 섹션을 참조하세요[전체 PHP 애플리케이션 소스](#service-source-code-php.examples.end2end).

### 파일 구조
<a name="service-source-code-php.compatibility.file-structure"></a>

는 웹 서버의 `root` 디렉터리 아래에 있는 `public` 폴더에 설치해야 `index.php` 합니다.

**참고**  
`startup.sh` 또는 `supervisord.conf` 파일은 웹 서버의 루트 디렉터리에 저장하는 것이 좋습니다. `start` 명령이 `startup.sh` 또는 `supervisord.conf` 파일이 저장된 위치를 가리키는지 확인합니다.

 다음은를 사용하는 경우 파일 구조의 예입니다*supervisord*.

```
/
├─ public/
│  ├─ index.php
├─ apprunner.yaml
├─ supervisord.conf
```

다음은 *시작 스크립트를 사용하는 경우 파일 구조의 *예입니다.

```
/
├─ public/
│  ├─ index.php
├─ apprunner.yaml
├─ startup.sh
```

App Runner 서비스에 지정된 코드 리포지토리 [소스 디렉터리](service-source-code.md#service-source-code.source-directory)에 이러한 파일 구조를 저장하는 것이 좋습니다.

```
/<sourceDirectory>/
├─ public/
│  ├─ index.php
├─ apprunner.yaml
├─ startup.sh
```

**중요**  
  기본 리포지토리 루트 [디렉터리 이외의 위치에서 App Runner 서비스의 코드 리포지토리 소스](service-source-code.md#service-source-code.source-directory) 디렉터리를 지정하려면 PHP 관리형 런타임 버전이 PHP `8.1.22` 이상이어야 합니다. 이전의 PHP 런타임 버전은 기본 루트 소스 디렉터리만 사용할 `8.1.22` 수 있습니다.    
App Runner는 모든 배포 또는 서비스 업데이트 시 서비스의 런타임을 최신 버전으로 업데이트합니다. [App Runner 구성 파일의](config-file.md) `runtime-version` 키워드를 사용하여 버전 잠금을 지정하지 않는 한 서비스는 기본적으로 최신 런타임을 사용합니다.

## PHP 런타임 예제
<a name="service-source-code-php.examples"></a>

다음은 PHP 서비스를 빌드하고 실행하는 데 사용되는 App Runner 구성 파일의 예입니다.

### 최소 PHP 구성 파일
<a name="service-source-code-php.examples.minimal"></a>

다음 예제는 PHP 관리형 런타임과 함께 사용할 수 있는 최소 구성 파일입니다. 최소 구성 파일에 대한 자세한 내용은 섹션을 참조하세요[구성 파일 예제](config-file-examples.md#config-file-examples.managed).

**Example apprunner.yaml**  

```
version: 1.0 
runtime: php81
build:
  commands:
    build:
      - echo example build command for PHP
run:
  command: ./startup.sh
```

### 확장 PHP 구성 파일
<a name="service-source-code-php.examples.extended"></a>

다음 예제에서는 PHP 관리형 런타임과 함께 모든 구성 키를 사용합니다.

**참고**  
이 예제에서 사용되는 런타임 버전은 *8.1.10*입니다. 이를 사용하려는 버전으로 바꿀 수 있습니다. 지원되는 최신 PHP 런타임 버전은 섹션을 참조하세요[PHP 런타임 릴리스 정보](service-source-code-php-releases.md).

**Example apprunner.yaml**  

```
version: 1.0
runtime: php81
build:
  commands:
     pre-build:
      - scripts/prebuild.sh
    build:
      - echo example build command for PHP
    post-build:
      - scripts/postbuild.sh
  env:
    - name: MY_VAR_EXAMPLE
      value: "example"
run:
  runtime-version: 8.1.10
  command: ./startup.sh
  network:
    port: 5000
    env: APP_PORT
  env:
    - name: MY_VAR_EXAMPLE
      value: "example"
```

### 전체 PHP 애플리케이션 소스
<a name="service-source-code-php.examples.end2end"></a>

다음 예제는 *Apache HTTP Server* 또는를 사용하여 PHP 런타임 서비스에 배포하는 데 사용할 수 있는 PHP 애플리케이션 소스 코드입니다*NGINX*. 이 예제에서는 기본 파일 구조를 사용한다고 가정합니다.

#### 를 Apache HTTP Server 사용하여에서 PHP 플랫폼 실행 supervisord
<a name="service-source-code-php.examples.end2end.appache-supervisord"></a>

**Example 파일 구조**  
+ `supervisord.conf` 파일은 리포지토리의 어디에나 저장할 수 있습니다. `start` 명령이 `supervisord.conf` 파일이 저장되는 위치를 가리키는지 확인합니다.
+ 는 `root` 디렉터리 아래의 `public` 폴더에 설치해야 `index.php` 합니다.

```
/
├─ public/
│  ├─ index.php
├─ apprunner.yaml
├─ supervisord.conf
```

**Example supervisord.conf**  

```
[supervisord]
nodaemon=true

[program:httpd]
command=httpd -DFOREGROUND
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:php-fpm]
command=php-fpm -F
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
```

**Example apprunner.yaml**  

```
version: 1.0
runtime: php81
build:
  commands:
    build:
      - PYTHON=python2 amazon-linux-extras install epel
      - yum -y install supervisor
run:
  command: supervisord
  network:
    port: 8080
    env: APP_PORT
```

**Example index.php**  

```
<html>
<head> <title>First PHP App</title> </head>
<body>
<?php
    print("Hello World!");
    print("<br>");
?>
</body>
</html>
```

#### 를 Apache HTTP Server 사용하여에서 PHP 플랫폼 실행 startup script
<a name="service-source-code-php.examples.end2end.appache-startupscript"></a>

**Example 파일 구조**  
+ `startup.sh` 파일은 리포지토리의 모든 위치에 저장할 수 있습니다. `start` 명령이 `startup.sh` 파일이 저장되는 위치를 가리키는지 확인합니다.
+ 는 `root` 디렉터리 아래의 `public` 폴더에 설치해야 `index.php` 합니다.

```
/
├─ public/
│  ├─ index.php
├─ apprunner.yaml
├─ startup.sh
```

**Example startup.sh**  

```
#!/bin/bash

set -o monitor

trap exit SIGCHLD

# Start apache
httpd -DFOREGROUND &

# Start php-fpm
php-fpm -F &

wait
```

**참고**  
`startup.sh` 파일을 Git 리포지토리에 커밋하기 전에 파일을 실행 파일로 저장해야 합니다. `chmod +x startup.sh`를 사용하여 `startup.sh` 파일에 대한 실행 권한을 설정합니다.
`startup.sh` 파일을 실행 파일로 저장하지 않는 경우를 `apprunner.yaml` 파일에 `build` 명령`chmod +x startup.sh`으로 입력합니다.

**Example apprunner.yaml**  

```
version: 1.0
runtime: php81
build:
  commands:
    build:
      - echo example build command for PHP
run:
  command: ./startup.sh
  network:
    port: 8080
    env: APP_PORT
```

**Example index.php**  

```
<html>
<head> <title>First PHP App</title> </head>
<body>
<?php
    print("Hello World!");
    print("<br>");
?>
</body>
</html>
```

#### 를 NGINX 사용하여에서 PHP 플랫폼 실행 supervisord
<a name="service-source-code-php.examples.end2end.nginx-supervisord"></a>

**Example 파일 구조**  
+ `supervisord.conf` 파일은 리포지토리의 어디에나 저장할 수 있습니다. `start` 명령이 `supervisord.conf` 파일이 저장되는 위치를 가리키는지 확인합니다.
+ 는 `root` 디렉터리 아래의 `public` 폴더에 설치해야 `index.php` 합니다.

```
/
├─ public/
│  ├─ index.php
├─ apprunner.yaml
├─ supervisord.conf
```

**Example supervisord.conf**  

```
[supervisord]
nodaemon=true

[program:nginx]
command=nginx -g "daemon off;"
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:php-fpm]
command=php-fpm -F
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
```

**Example apprunner.yaml**  

```
version: 1.0
runtime: php81
build:
  commands:
    build:
      - PYTHON=python2 amazon-linux-extras install epel
      - yum -y install supervisor
run:
  command: supervisord
  network:
    port: 8080
    env: APP_PORT
```

**Example index.php**  

```
<html>
<head> <title>First PHP App</title> </head>
<body>
<?php
    print("Hello World!");
    print("<br>");
?>
</body>
</html>
```

#### 를 NGINX 사용하여에서 PHP 플랫폼 실행 startup script
<a name="service-source-code-php.examples.end2end.nginx-startupscript"></a>

**Example 파일 구조**  
+ `startup.sh` 파일은 리포지토리의 모든 위치에 저장할 수 있습니다. `start` 명령이 `startup.sh` 파일이 저장되는 위치를 가리키는지 확인합니다.
+ 는 `root` 디렉터리 아래의 `public` 폴더에 설치해야 `index.php` 합니다.

```
/
├─ public/
│  ├─ index.php
├─ apprunner.yaml
├─ startup.sh
```

**Example startup.sh**  

```
#!/bin/bash

set -o monitor

trap exit SIGCHLD

# Start nginx 
nginx -g 'daemon off;' &

# Start php-fpm
php-fpm -F &

wait
```

**참고**  
`startup.sh` 파일을 Git 리포지토리에 커밋하기 전에 파일을 실행 파일로 저장해야 합니다. `chmod +x startup.sh`를 사용하여 `startup.sh` 파일에 대한 실행 권한을 설정합니다.
`startup.sh` 파일을 실행 파일로 저장하지 않는 경우를 `apprunner.yaml` 파일에 `build` 명령`chmod +x startup.sh`으로 입력합니다.

**Example apprunner.yaml**  

```
version: 1.0
runtime: php81
build:
  commands:
    build:
      - echo example build command for PHP
run:
  command: ./startup.sh
  network:
    port: 8080
    env: APP_PORT
```

**Example index.php**  

```
<html>
<head> <title>First PHP App</title> </head>
<body>
<?php
    print("Hello World!");
    print("<br>");
?>
</body>
</html>
```

# PHP 런타임 릴리스 정보
<a name="service-source-code-php-releases"></a>

**중요**  
App Runner는 2025년 **12월 31일에 PHP 8.**1에 대한 지원을 종료합니다. 권장 사항 및 자세한 내용은 섹션을 참조하세요[관리형 런타임 버전에 대한 지원 종료](service-source-code.md#service-source-code.managed-platforms.eos).

이 주제에서는 App Runner가 지원하는 PHP 런타임 버전에 대한 전체 세부 정보를 나열합니다.


**지원되는 런타임 버전 - 원래 App Runner 빌드**  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/apprunner/latest/dg/service-source-code-php-releases.html)

**참고**  
App Runner는 최근에 릴리스된 특정 주요 런타임에 대해 수정된 빌드 프로세스를 제공합니다. 따라서이 문서의 특정 섹션에 *수정된 App Runner 빌드* 및 *원래 App Runner 빌드*에 대한 참조가 표시됩니다. 자세한 내용은 단원을 참조하십시오[관리형 런타임 버전 및 App Runner 빌드](service-source-code.md#service-source-code.build-detail).