CentOS APC 설치

Jmnote (토론 | 기여)님의 2013년 2월 10일 (일) 01:31 판 (→‎같이 보기)
APC

1 주의사항

VirtualHost 사용 환경에서는 APC가 정상 작동하지 않는다. 한 서버에서 여러 개의 도메인을 사용하는 등의 목적으로 httpd.conf에 VirtualHost를 설정하는데 제대로 작동하지 않았다.[1]

2 사전작업

pecl install로 설치할 예정인데, 정상적으로 설치하기 위해서는 pecl, gcc, phpize, make 명령어를 사용할 수 있는 환경이 되어야 한다.

설치확인
[root@jmnote ~]# pecl version
PEAR Version: 1.4.9
PHP Version: 5.2.10
Zend Engine Version: 2.2.0
Running on: Linux jmnote.com 2.6.18-274.3.1.el5xen #1 SMP Tue Sep 6 20:57:11 EDT 2011 x86_64
[root@jmnote ~]# gcc
gcc: no input files
[root@jmnote ~]# phpize
Cannot find config.m4. 
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module
[root@jmnote ~]# make 
make: *** No targets specified and no makefile found.  Stop.
→ 정상적으로 설치되어 있다면 위와 같이 나온다.

3 APC 설치

명령어
pecl install apc
실행예시
[root@jmnote ~]# pecl install apc
downloading APC-3.1.9.tgz ...
Starting to download APC-3.1.9.tgz (155,540 bytes)
.................................done: 155,540 bytes
54 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
Enable internal debugging in APC [no] :

Enter 키 입력.

Enable per request file info about files used from the APC cache [no] : 
Enable spin locks (EXPERIMENTAL) [no] : 
Enable memory protection (EXPERIMENTAL) [no] : 
Enable pthread mutexes (default) [yes] : 
Enable pthread read/write locks (EXPERIMENTAL) [no] :

모두 Enter 키 입력

... (생략)
Build process completed successfully
Installing '/var/tmp/pear-build-root/install-APC-3.1.9//usr/include/php/ext/apc/apc_serializer.h'
Installing '/var/tmp/pear-build-root/install-APC-3.1.9//usr/lib64/php/modules/apc.so'
install ok: channel://pecl.php.net/APC-3.1.9
You should add "extension=apc.so" to php.ini
→ 정상적으로 빌드되었으며, /usr/lib64/php/modules/apc.so 이 생성되었다.
php.iniextension=apc.so를 추가해야 한다고 알려준다.

4 PHP와 APC 연동

위에서는 php.ini에 추가하라고 했지만, /etc/php.d에 별도의 파일로 추가해도 된다. 추가 후에는 아파치를 재시작해야 한다.

명령어
echo 'extension=apc.so' > /etc/php.d/apc.ini
service httpd restart
실행예시
[root@jmnote ~]# echo 'extension=apc.so' > /etc/php.d/apc.ini
[root@jmnote ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

5 같이 보기

6 주석

  1. 아무 오류메시지가 없는데 브라우저로 접속하면 로딩만 계속하는 현상이 나타났다.
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}