apache/php mbstring.so 모듈 추가하기

시스템운영/Apache+PHP|2012.11.26 18:13

 

 

apache/php mbstring.so 모듈 추가하기

 

설치정보 요약

1. php 소스 디렉토리로 이동
cd /php-5.2.5/ext/mbstring

*혹시 php소스 경로가 기역이 안난다면 find / -name mbstring 로 검색

 


2)phpize를 실행하여 확장 모듈파일 생성을 위한 준비 시작
/usr/local/bin/phpize

 *configure 를 위한 파일이 생성됨

 

 

3) 추가 컴파일 진행
./configure --with-php-config=/usr/local/bin/php-config

 

 

4) so 파일 생성
make

*mbstring.so 파일은 make한경로 아래의 modules경로 밑에 mbstring.so 파일이 생성됨

 

5) mbstring.so 모듈 복사
cat php.ini | grep extension_dir
extension_dir로 나온 경로가 모듈을 인식하는 경로이다.
기본 경로는 /usr/local/php/module/ 이다.

cp /php-5.2.5/ext/mbstring/modules/mbstrings.so /usr/local/php/module/

 

 

 

6) php.ini 편집
vi php.ini
extension=mbstring.so // 내용추가

 

7) 이후 apache 재시작

./apachectl restart


8) phpinfo 페이지 생성 후 웹에서 확인

   PHP 설치 정보 확인 방법은 아래의 phpinfo내용을 php 파일로 저장하여 웹으로 실행 시키면 된다.

   그럼 내용중 mbstring 이란 항목을 볼 수 있음

 

<? phpinfo(); ?>

 

 

설치 정보 상세 

[root@hosts /]#cd /php-5.2.5/ext/mbstring

[root@hosts mbstring]#/usr/local/bin/phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
[root@hosts mbstring]#

[root@hosts mbstring]# ./configure --with-php-config=/usr/local/bin/php-config
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether gcc and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM

-I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20060613
checking for PHP installed headers prefix... /usr/local/include/php
checking for re2c... no
configure: WARNING: You will need re2c 0.12.0 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable multibyte string support... yes, shared
checking whether to enable multibyte regex support... yes
checking whether to check multibyte regex backtrack... yes
checking for external libmbfl... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for variable length prototypes and stdarg.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for unistd.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/times.h usability... yes
checking sys/times.h presence... yes
checking for sys/times.h... yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking for int... yes
checking size of int... 4
checking for short... yes
checking size of short... 2
checking for long... yes
checking size of long... 4
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for working memcmp... yes
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flag  works... yes
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h

 

[root@hosts mbstring]#make
*내용생략*

so
creating mbstring.la
(cd .libs && rm -f mbstring.la && ln -s ../mbstring.la mbstring.la)
/bin/sh /install_source/src/php-5.2.5/ext/mbstring/libtool --mode=install cp ./mbstring.la

/install_source/src/php-5.2.5/ext/mbstring/modules
cp ./.libs/mbstring.so /install_source/src/php-5.2.5/ext/mbstring/modules/mbstring.so
cp ./.libs/mbstring.lai /install_source/src/php-5.2.5/ext/mbstring/modules/mbstring.la
PATH="$PATH:/sbin" ldconfig -n /install_source/src/php-5.2.5/ext/mbstring/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /install_source/src/php-5.2.5/ext/mbstring/modules  // mbstings.so 파일이 존재하는 경로

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 the `LD_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'.


[root@hosts mbstring]#cp /php-5.2.5/ext/mbstring/modules/mbstrings.so /usr/local/php/module/

[root@hosts mbstring]#vi /usr/local/apache2/conf/php.ini

[root@hosts mbstring]#/usr/local/apache2/bin/apachectl restart

 


 

 

댓글()
  1. 2012.11.28 23:14 댓글주소  수정/삭제  댓글쓰기

    덕분에 해결되었습니다.