"CentOS APC 설치"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(사용자 3명의 중간 판 6개는 보이지 않습니다)
1번째 줄: 1번째 줄:
;Alternative PHP Cache 설치
{{다른뜻|우분투 APC 설치}}
;APC 설치
;CentOS Alternative PHP Cache 설치
;CentOS APC 설치


==사전작업==
==사전작업==
10번째 줄: 11번째 줄:
*[[make 설치]] (설치여부는 명령어 <code>make</code>로 확인)
*[[make 설치]] (설치여부는 명령어 <code>make</code>로 확인)
*[[pcre-devel 설치]]
*[[pcre-devel 설치]]
;한방 설치 명령어
<syntaxhighlight lang='bash'>
yum install php-pear gcc php-devel make pcre-devel
</syntaxhighlight>
;설치확인
;설치확인
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# pecl version
[root@zetawiki ~]# pecl version
PEAR Version: 1.4.9
PEAR Version: 1.4.9
PHP Version: 5.2.10
PHP Version: 5.2.10
Zend Engine Version: 2.2.0
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
Running on: Linux jmnote.com 2.6.18-274.3.1.el5xen #1 SMP Tue Sep 6 20:57:11 EDT 2011 x86_64
</source>
</syntaxhighlight>
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# gcc
[root@zetawiki ~]# gcc
gcc: no input files
gcc: no input files
</source>
</syntaxhighlight>
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# phpize
[root@zetawiki ~]# phpize
Cannot find config.m4.  
Cannot find config.m4.  
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module
Make sure that you run '/usr/bin/phpize' in the top level syntaxhighlight directory of the module
</source>
</syntaxhighlight>
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# make  
[root@zetawiki ~]# make  
make: *** No targets specified and no makefile found.  Stop.
make: *** No targets specified and no makefile found.  Stop.
</source>
</syntaxhighlight>
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# yum list installed php-pear gcc php-devel make pcre-devel
[root@zetawiki ~]# yum list installed php-pear gcc php-devel make pcre-devel
... (생략)
... (생략)
Installed Packages
Installed Packages
40번째 줄: 47번째 줄:
php-devel.x86_64                                                5.3.3-22.el6                                                @base
php-devel.x86_64                                                5.3.3-22.el6                                                @base
php-pear.noarch                                                  1:1.9.4-4.el6                                                @base
php-pear.noarch                                                  1:1.9.4-4.el6                                                @base
</source>
</syntaxhighlight>
:→ 정상적으로 설치되어 있다면 위와 같이 나온다.
:→ 정상적으로 설치되어 있다면 위와 같이 나온다.
;한방 설치 명령어
<source lang='bash'>
yum install php-pear gcc php-devel make pcre-devel
</source>


==APC 설치==
==APC 설치==
;명령어
;명령어
<source lang='bash'>
<syntaxhighlight lang='bash'>
pecl install apc
pecl install apc
</source>
</syntaxhighlight>


;실행예시
;실행예시
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# pecl install apc
[root@zetawiki ~]# pecl install apc
downloading APC-3.1.13.tgz ...
downloading APC-3.1.13.tgz ...
Starting to download APC-3.1.13.tgz (171,591 bytes)
Starting to download APC-3.1.13.tgz (171,591 bytes)
.....................................done: 171,591 bytes
.....................................done: 171,591 bytes
55 source files, building
55 syntaxhighlight files, building
running: phpize
running: phpize
Configuring for:
Configuring for:
67번째 줄: 69번째 줄:
Zend Extension Api No:  220090626
Zend Extension Api No:  220090626
Enable internal debugging in APC [no] :  
Enable internal debugging in APC [no] :  
</source>
</syntaxhighlight>
{{Enter}} 키 입력.
{{Enter}} 키 입력.
<source lang='dos'>
<syntaxhighlight lang='console'>
Enable per request file info about files used from the APC cache [no] :  
Enable per request file info about files used from the APC cache [no] :  
Enable spin locks (EXPERIMENTAL) [no] :  
Enable spin locks (EXPERIMENTAL) [no] :  
75번째 줄: 77번째 줄:
Enable pthread mutexes (default) [no] :  
Enable pthread mutexes (default) [no] :  
Enable pthread read/write locks (EXPERIMENTAL) [yes] :  
Enable pthread read/write locks (EXPERIMENTAL) [yes] :  
</source>
</syntaxhighlight>
모두 {{Enter}} 키 입력
모두 {{Enter}} 키 입력
<source lang='dos'>
<syntaxhighlight lang='console'>
... (생략)
... (생략)
Build process completed successfully
Build process completed successfully
85번째 줄: 87번째 줄:
configuration option "php_ini" is not set to php.ini location
configuration option "php_ini" is not set to php.ini location
You should add "extension=apc.so" to php.ini
You should add "extension=apc.so" to php.ini
</source>
</syntaxhighlight>
:→ 정상적으로 빌드되었으며, /usr/lib64/php/modules/apc.so 이 생성되었다.
:→ 정상적으로 빌드되었으며, /usr/lib64/php/modules/apc.so 이 생성되었다.
:→ [[php.ini]]에 <code>extension=apc.so</code>를 추가해야 한다고 알려준다.
:→ [[php.ini]]에 <code>extension=apc.so</code>를 추가해야 한다고 알려준다.
91번째 줄: 93번째 줄:
==PHP와 APC 연동==
==PHP와 APC 연동==
===VirtualHost 없는 경우===
===VirtualHost 없는 경우===
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# php -m | grep apc
[root@zetawiki ~]# php -m | grep apc
</source>
</syntaxhighlight>
:→ 연동 안됨
:→ 연동 안됨


*[[php.ini]]의 맨아래에 다음 내용을 추가
*[[php.ini]]의 맨아래에 다음 내용을 추가
<source lang='properties'>
<syntaxhighlight lang='properties'>
[apc]
[apc]
extension=apc.so
extension=apc.so
</source>
</syntaxhighlight>


<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# php -m | grep apc
[root@zetawiki ~]# php -m | grep apc
apc
apc
</source>
</syntaxhighlight>
:→ 연동됨
:→ 연동됨


112번째 줄: 114번째 줄:


*php.ini의 맨아래에 다음 내용을 추가
*php.ini의 맨아래에 다음 내용을 추가
<source lang='properties'>
<syntaxhighlight lang='properties'>
[apc]
[apc]
extension=apc.so
extension=apc.so
apc.cache_by_default=0
apc.cache_by_default=0
</source>
</syntaxhighlight>
:→ 일단 apc 캐시를 사용하지 않도록 설정
:→ 일단 apc 캐시를 사용하지 않도록 설정


*캐시되기 원하는 VirtualHost의 웹루트폴더의 .htaccess 파일에 다음 내용 추가
*캐시되기 원하는 VirtualHost의 웹루트폴더의 .htaccess 파일에 다음 내용 추가
<source lang='php'>
<syntaxhighlight lang='php'>
php_flag apc.cache_by_default On
php_flag apc.cache_by_default On
</source>
</syntaxhighlight>


==아파치 재시작==
==아파치 재시작==
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# service httpd restart
[root@zetawiki ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:34 기준 최신판

  다른 뜻에 대해서는 우분투 APC 설치 문서를 참조하십시오.
CentOS Alternative PHP Cache 설치
CentOS APC 설치

1 사전작업[ | ]

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

한방 설치 명령어
yum install php-pear gcc php-devel make pcre-devel
설치확인
[root@zetawiki ~]# 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@zetawiki ~]# gcc
gcc: no input files
[root@zetawiki ~]# phpize
Cannot find config.m4. 
Make sure that you run '/usr/bin/phpize' in the top level syntaxhighlight directory of the module
[root@zetawiki ~]# make 
make: *** No targets specified and no makefile found.  Stop.
[root@zetawiki ~]# yum list installed php-pear gcc php-devel make pcre-devel
... (생략)
Installed Packages
gcc.x86_64                                                       4.4.7-3.el6                                                  @base
make.x86_64                                                      1:3.81-20.el6                                                @base
pcre-devel.x86_64                                                7.8-6.el6                                                    @base
php-devel.x86_64                                                 5.3.3-22.el6                                                 @base
php-pear.noarch                                                  1:1.9.4-4.el6                                                @base
→ 정상적으로 설치되어 있다면 위와 같이 나온다.

2 APC 설치[ | ]

명령어
pecl install apc
실행예시
[root@zetawiki ~]# pecl install apc
downloading APC-3.1.13.tgz ...
Starting to download APC-3.1.13.tgz (171,591 bytes)
.....................................done: 171,591 bytes
55 syntaxhighlight files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
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) [no] : 
Enable pthread read/write locks (EXPERIMENTAL) [yes] :

모두 Enter 키 입력

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

3 PHP와 APC 연동[ | ]

3.1 VirtualHost 없는 경우[ | ]

[root@zetawiki ~]# php -m | grep apc
→ 연동 안됨
  • php.ini의 맨아래에 다음 내용을 추가
[apc]
extension=apc.so
[root@zetawiki ~]# php -m | grep apc
apc
→ 연동됨

3.2 VirtualHost 있는 경우[ | ]

httpd.conf에서 VirtualHost를 사용하는 경우에는 정상작동을 위해 조금 다른 설정이 필요하다.[1]

  • php.ini의 맨아래에 다음 내용을 추가
[apc]
extension=apc.so
apc.cache_by_default=0
→ 일단 apc 캐시를 사용하지 않도록 설정
  • 캐시되기 원하는 VirtualHost의 웹루트폴더의 .htaccess 파일에 다음 내용 추가
php_flag apc.cache_by_default On

4 아파치 재시작[ | ]

[root@zetawiki ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

5 같이 보기[ | ]

6 주석[ | ]

  1. 여러 VirtualHost에 적용이 되지 않는 모양이다.
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}