STEP 1.

[root@Cacti /]# pwd
/
[root@Cacti /]# cd /download/
[root@Cacti download]# ll
total 50240
drwxr-xr-x 12 celltwo users     4096 Feb 13 16:22 httpd-2.2.11
-rw-r--r--  1 root    root   6806786 Dec 13 23:35 httpd-2.2.11.tar.gz
drwxr-xr-x 39     503 users     4096 Feb 13 15:36 mysql-5.0.75
-rw-r--r--  1 root    root  32514150 Dec 19 03:01 mysql-5.0.75.tar.gz
-rw-r--r--  1 root    root  12046184 May  1  2008 php-5.2.6.tar.gz

[root@Cacti download]#


위와 같이 앞에서 PHP를 다운 받은 디렉토리로 이동을 한 후 압축을 해제 하자.

[root@Cacti download]# tar xvfz php-5.2.6.tar.gz
.......... 글 몇개 읽으면 알겠지만 길면 생략한다 ..............
php-5.2.6/CODING_STANDARDS
php-5.2.6/mkinstalldirs
php-5.2.6/README.TESTING2
php-5.2.6/footer
php-5.2.6/header
php-5.2.6/netware/
php-5.2.6/netware/start.c
php-5.2.6/netware/sendmail_nw.h
php-5.2.6/php5.spec.in
php-5.2.6/UPGRADING
php-5.2.6/cvsclean
php-5.2.6/README.EXTENSIONS
php-5.2.6/README.QNX
php-5.2.6/run-tests.php
php-5.2.6/acinclude.m4
php-5.2.6/README.SELF-CONTAINED-EXTENSIONS
php-5.2.6/stub.c
php-5.2.6/buildconf
php-5.2.6/stamp-h.in
php-5.2.6/README.input_filter
php-5.2.6/generated_lists
php-5.2.6/README.Zeus
php-5.2.6/INSTALL
php-5.2.6/TODO-PHP5
php-5.2.6/EXTENSIONS
php-5.2.6/server-tests-config.php
php-5.2.6/snapshot
php-5.2.6/php.gif
php-5.2.6/README.PARAMETER_PARSING_API
php-5.2.6/acconfig.h
php-5.2.6/README.PHP4-TO-PHP5-THIN-CHANGES
php-5.2.6/CREDITS
php-5.2.6/README.UPDATE_5_2
php-5.2.6/README.UNIX-BUILD-SYSTEM
php-5.2.6/buildconf.bat

[root@Cacti download]#




STEP 2.

configure를 하기 위해서 압축을 푼 php 디렉토리로 이동을 한 후 configure를 한다.

[root@Cacti download]# cd php-5.2.6
[root@Cacti php-5.2.6]# ./configure --prefix=/usr/local/server/php --with-apxs2=/usr/local/server/apache/bin/apxs --with-mysql=/usr/local/server/mysql --with-config-file-path=/usr/local/server/apache/conf --disable-debug --enable-safe-mode --enable-track-vars --enable-sockets --with-mod_charset --with-charset=utf8 --with-xml --with-language=korean --enable-mailparse --enable-calender --enable-sysvsem=yes --enable-sysvshm=yes --enable-ftp --enable-magic-quotes --enable-gd-native-ttf --enable-url-includes --enable-trans-id --enable-inline-optimization --enable-bcmath --with-jpeg --with-png --with-zlib --with-jpeg-dir=/usr --with-png-dir=/usr/lib --with-freetype-dir=/usr --with-libxml-dir=/usr --enable-exif --with-gd --with-ttf --with-gettext --enable-sigchild --enable-mbstring
................ 생략 ................
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

Generating files
updating cache ./config.cache
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/man1/phpize.1
creating scripts/php-config
creating scripts/man1/php-config.1
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

Notice: Following unknown configure options were used:

--enable-track-vars
--with-mod_charset
--with-charset=utf8
--with-xml
--with-language=korean
--enable-mailparse
--enable-calender
--enable-url-includes
--enable-trans-id
--with-jpeg
--with-png
--with-freetype=dir=/usr

Check './configure --help' for available options

[root@Cacti php-5.2.6]#


--prefix=/usr/local/server/php는 php가 설치될 디렉토리 경로이다.
--with-apxs2=/usr/local/server/apache/bin/apxs는 Apache의 apxs를 이용해 아파치에 모듈을 적재한다.
--with-mysql=/usr/local/server/mysql은 MySQL과 연동한다.
--with-config-file-path=/usr/local/server/apache/conf는 php의 환경설정 파일인 php.ini가 생성 될 위치이다.

그 외 각종 라이브러리를 포함하는 옵션이다.



STEP 3.

make와 make install을 실행한다.

[root@Cacti php-5.2.6]# make && make install
................ 생략 .....................
/spprintf.lo main/php_sprintf.lo main/safe_mode.lo main/fopen_wrappers.lo main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo main/php_ticks.lo main/network.lo main/php_open_temporary_file.lo main/php_logos.lo main/output.lo main/streams/streams.lo main/streams/cast.lo main/streams/memory.lo main/streams/filter.lo main/streams/plain_wrapper.lo main/streams/userspace.lo main/streams/transports.lo main/streams/xp_socket.lo main/streams/mmap.lo Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/php_cli_readline.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lcrypt -lrt -lmysqlclient -lpng -lz -ljpeg -lz -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt  -o sapi/cli/php

Build complete.
Don't forget to run 'make test'.

Installing PHP SAPI module:       apache2handler
/usr/local/server/apache/build/instdso.sh SH_LIBTOOL='/usr/local/server/apache/build/libtool' libphp5.la /usr/local/server/apache/modules
/usr/local/server/apache/build/libtool --mode=install cp libphp5.la /usr/local/server/apache/modules/
cp .libs/libphp5.so /usr/local/server/apache/modules/libphp5.so
cp .libs/libphp5.lai /usr/local/server/apache/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /download/php-5.2.6/libs'
chmod 755 /usr/local/server/apache/modules/libphp5.so
[activating module `php5' in /usr/local/server/apache/conf/httpd.conf]
Installing PHP CLI binary:        /usr/local/server/php/bin/
Installing PHP CLI man page:      /usr/local/server/php/man/man1/
Installing build environment:     /usr/local/server/php/lib/php/build/
Installing header files:          /usr/local/server/php/include/php/
Installing helper programs:       /usr/local/server/php/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/server/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/server/php/lib/php/
[PEAR] Console_Getopt - installed: 1.2.3
[PEAR] Archive_Tar    - installed: 1.3.2
[PEAR] Structures_Graph- installed: 1.0.2
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
[PEAR] PEAR           - installed: 1.7.1
Wrote PEAR system config file at: /usr/local/server/php/etc/pear.conf
You may want to add: /usr/local/server/php/lib/php to your php.ini include_path
Installing PDO headers:          /usr/local/server/php/include/php/ext/pdo/

[root@Cacti php-5.2.6]#




STEP 4.

PHP의 환경 설정을 한다. /usr/local/server/apache/conf에 php.ini라는 이름으로 복사 한다.

[root@Cacti php-5.2.6]# cp php.ini-dist /usr/local/server/apache/conf/php.ini
[root@Cacti php-5.2.6]#


Apache와 연동을 위해서 httpd.conf 파일을 수정을 해야 한다.

[root@Cacti php-5.2.6]# vi /usr/local/server/apache/conf/httpd.conf
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#  
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>


위와 같은 부분에 아래와 같이 추가 시켜준다.

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#  
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>



<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
   
    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi
   
    # For type maps (negotiated resources):
    #AddHandler type-map var
   
    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

위 와 같은 문구에 아래와 같이 추가 시켜준다.

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
   
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi
   
    # For type maps (negotiated resources):
    #AddHandler type-map var
   
    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>




STEP 5.

PHP가 설치가 완료 되었으니 테스트를 해 본다.

[root@Cacti php-5.2.6]# /etc/init.d/httpd restart
httpd not running, trying to start
[root@Cacti php-5.2.6]#


테스트 페이지를 만들어서 php의 정보를 보여주는 함수를 사용해 본다.

[root@Cacti php-5.2.6]# vi /usr/local/server/apache/htdocs/phpinfo.php
<? phpinfo(); ?>


아래와 같이 웹서버에 출력이 되면, PHP 설치가 완료 된다.

블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.

,