PHP 통합 · 2 min read · Oct 24, 2025
PHP5에 APC (Alternative PHP Cache) 통합하기 (Fedora 8 & Apache2)
PHP5에 APC (Alternative PHP Cache) 통합하기 (Fedora 8 & Apache2)
버전 1.0
저자: Falko Timme
이 가이드는 Fedora 8 시스템에서 PHP5에 APC (Alternative PHP Cache)를 통합하는 방법을 설명합니다 (Apache2와 함께). APC는 PHP 중간 코드를 캐싱하고 최적화하기 위한 무료 오픈 PHP opcode 캐셔입니다. ** eAccelerator 및 XCache와 같은 다른 PHP opcode 캐셔와 유사합니다.
이것이 당신에게 작동할 것이라는 보장은 하지 않습니다!
1 사전 참고
저는 Apache2와 PHP5가 이미 설치되어 작동 중인 IP 주소 192.168.0.100의 Fedora 8 서버에서 이것을 테스트했습니다. 이 튜토리얼에서는 시연 목적으로 Apache의 기본 문서 루트 /var/www/html을 사용할 것입니다. 물론 다른 vhost를 사용할 수도 있지만, 이 튜토리얼에서 사용하는 info.php 파일의 경로를 조정해야 할 수도 있습니다.
2 PHP5의 현재 상태 확인하기
먼저 APC를 설치하기 전에 PHP5 설치에 대해 알아봅시다. 이를 위해 문서 루트 /var/www/html에 info.php 파일을 생성합니다:
vi /var/www/html/info.php| |
그 후, 브라우저에서 해당 파일을 호출합니다: http://192.168.0.100/info.php
보시다시피, PHP 5.2.4가 설치되어 있습니다…

… 하지만 APC는 페이지 어디에도 언급되어 있지 않습니다:

3 APC 설치하기
APC는 PECL을 사용하여 설치할 수 있는 PHP 확장입니다. PECL은 php-pear 패키지와 함께 제공되므로, 지금 설치하겠습니다:
yum install php-pear또한 PECL이 APC를 빌드할 수 있도록 몇 가지 APC 종속성을 설치해야 합니다:
yum install php-devel httpd-develyum groupinstall 'Development Tools'yum groupinstall 'Development Libraries'모든 종속성이 설치되었으므로, 다음과 같이 APC를 설치할 수 있습니다:
pecl install apc[root@server1 ~]# pecl install apc
downloading APC-3.0.18.tgz …
Starting to download APC-3.0.18.tgz (115,957 bytes)
…………………….done: 115,957 bytes
47 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
- Use apxs to set compile flags (if using APC with Apache)? : yes
1-1, ‘all’, ‘abort’, or Enter to continue: <– ENTER
[…]
———————————————————————-
Libraries have been installed in:
/var/tmp/pear-build-root/APC-3.0.18/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the -LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to theLD_LIBRARY_PATH’ environment variable
during execution
- add LIBDIR to the
LD_RUN_PATH' environment variable during linking - use the-Wl,–rpath -Wl,LIBDIR’ linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf’
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
———————————————————————-
Build complete.
Don’t forget to run ‘make test’.
running: make INSTALL_ROOT=”/var/tmp/pear-build-root/install-APC-3.0.18” install
Installing shared extensions: /var/tmp/pear-build-root/install-APC-3.0.18/usr/lib/php/modules/
running: find “/var/tmp/pear-build-root/install-APC-3.0.18” -ls
1996900 4 drwxr-xr-x 3 root root 4096 Apr 8 16:32 /var/tmp/pear-build-root/install-APC-3.0.18
1996959 4 drwxr-xr-x 3 root root 4096 Apr 8 16:32 /var/tmp/pear-build-root/install-APC-3.0.18/usr
1996960 4 drwxr-xr-x 3 root root 4096 Apr 8 16:32 /var/tmp/pear-build-root/install-APC-3.0.18/usr/lib
1996961 4 drwxr-xr-x 3 root root 4096 Apr 8 16:32 /var/tmp/pear-build-root/install-APC-3.0.18/usr/lib/php
1996962 4 drwxr-xr-x 2 root root 4096 Apr 8 16:32 /var/tmp/pear-build-root/install-APC-3.0.18/usr/lib/php/modules
1996958 432 -rwxr-xr-x 1 root root 435950 Apr 8 16:32 /var/tmp/pear-build-root/install-APC-3.0.18/usr/lib/php/modules/apc.so
Build process completed successfully
Installing ‘/usr/lib/php/modules/apc.so’
install ok: channel://pecl.php.net/APC-3.0.18
configuration option “php_ini” is not set to php.ini location
You should add “extension=apc.so” to php.ini
[root@server1 ~]# 이제 APC가 설치되었으므로, 구성 파일 /etc/php.d/apc.ini를 생성합니다. 그 안에 최소한 extension=apc.so 라인을 추가해야 하며, 다른 모든 구성 옵션은 선택 사항입니다. http://de2.php.net/manual/en/ref.apc.php에서 사용 가능한 모든 구성 옵션 목록을 찾을 수 있습니다.vi /etc/php.d/apc.ini|extension=apc.so apc.enabled=1 apc.shm_size=30| 그게 전부입니다. Apache를 재시작하면 완료됩니다:/etc/init.d/httpd restart그 후, 브라우저에서 info.php를 다시 엽니다: http://192.168.0.100/info.php 이제 페이지에 APC가 언급되어 있어야 하며, 이는 성공적으로 통합되어 예상대로 작동하고 있음을 의미합니다:
### 4 링크 - APC: http://pecl.php.net/package/APC - PHP: http://www.php.net - Apache: http://httpd.apache.org - Fedora: http://fedoraproject.org
새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.