rand(life)

apache-2.2.2, php-5.1.4,mysql-beta-5.1.12,mssql6.0 연결 설치 본문

컴퓨터/리눅스

apache-2.2.2, php-5.1.4,mysql-beta-5.1.12,mssql6.0 연결 설치

flogsta 2007. 3. 30. 19:34

http://blog.naver.com/techbug/150008620180

apache-2.2.2, php-5.1.4,mysql-beta-5.1.12,mssql6.0 연결 설치




os                  : Fedora5
apache           : 2.2.2
php                : 5.1.4
mysql             : mysql-5.1.9-beta
freeTds           : 0.63  (windows+ms-sql 연결)

ZendOptimizer :3.0.0



rpm 삭제

rpm -e --nodeps httpd
rpm -e --nodeps php
rpm -e --nodeps mysql




1)mysql-5.1.9-bata.tar.gz

#wget ftp://ftp.orst.edu/pub/mysql/Downloads/MySQL-5.1/mysql-5.1.9-beta.tar.gz
# tar zxvf mysql-5.1.9-beta.tar.gz
# cd mysql-5.1.9
# ./configure --prefix=/usr/local/mysql --localstatedir=/home/nugu/down/mysql-5.1.9-beta --disable-shared --enable-assembler --with-thread-safe-client --with-mysqld-user="mysql" --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-readline --without-debug --without-docs --without-bench --with-charset=euckr
=>4.1.x 이상은 'euckr' , 4.0.x 이하는 'euc_kr'

...........
...........
...........
...........
............

에러 없으면
# make
# make install
------------------------------------------------------------------------------------
# cp support-files/my-huge.cnf /etc/my.cnf ==> 1G~2G memory
# cd /usr/local/mysql
# ./bin/mysql_install_db :기존에 Mysql을 설치하지 않았을 경우 grant table을 만들어줍니다
------------------------------------------------------------------------------------
# groupadd mysql
# useradd -M mysql 1) <= 이게 안되면
# adduser mysql -g mysql 2) <= 이걸로

# usermod -s /sbin/nologin mysql => telnet 제한

Mysql 디렉토리의 권한을 설정.
# chown -R root.mysql /usr/local/mysql/
# chown -R mysql.mysql /home/mysqldata/
------------------------------------------------------------------------------------
# ln -s /usr/local/mysql/bin/mysql /usr/bin/
# ln -s /usr/local/mysql/bin/mysqldump /usr/bin/
# cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysql
# chmod 755 /etc/rc.d/init.d/mysql
------------------------------------------------------------------------------------
Mysql을 실행.
# echo "# MySQL Start" >> /etc/rc.d/rc.local
# echo "/etc/rc.d/init.d/mysql start" >> /etc/rc.d/rc.local
# /usr/local/mysql/bin/mysqladmin -u root password 'angel'
------------------------------------------------------------------------------------
#/etc/rc.d/init.d/mysql start



2) freetds-0.63.tar.gz(설치 ms-sql)연동을 위한 프로그램

# ./configure --prefix=/usr/local/freetds --with-tdsver=4.2 --enable-msdblib --enable-dbmfix

(한줄로 실행 하거나 칸 이동시에는
--withd-tdsver=4.2 \
--enable-msdblib --enable-dbmfix

--withd-tdsver x.x => 요기는 MS-SQL버전 확인용
msSql2000 => 8.0 --with-tdsver=8.0
msSql7.0 => 7.0 --with-tdsver=7.0
msSql6.0 => 4.2 --with-tdsver=4.2

확인 해서 안되면 무존건 --with-tdsver=4.2 입력 해줌 )

..........
..........
..........

에러 없으면

# make
# make install

# cd /usr/local/freetds/etc 컴파일 완료 되면 이동 하거나
or
# vi /usr/local/freetds/etc/freetds.conf 수정

수정 부분 [MyServer2k] 부분 주석 제거

# A typical Microsoft SQL Server 7.0 configuration
;[MyServer70]
; host = ntmachine.domain.com
; port = 1433
; tds version = 7.0
# A typical Microsoft SQL Server 2000 configuration
***주석 제거***
;[MyServer2k]
; host =ntmachine.domain.com

; port = 1433

; tds version = 8.0 <----- msSql2000 버전을 뜻함
***주석 제거***
# A typical Microsoft SQL Server 6.x configuration
;[MyServer65]
; host = 192.168.10.2 <----- 연결할 ip 주소
; port = 1433 <----- msSql 포트 번호 그냥 나둠
; tds version = 4.2 <----- msSql6.0 버전을 뜻함


3) httpd-2.2.2.tar.gz

버전(httpd-2.2.2)
#wget http://ftp.apache-kr.org/httpd/httpd-2.2.2.tar.gz
#tar xvzf httpd-2.2.2.tar.gz
#cd httpd-2.2.2
./configure --prefix=/usr/local/apache2 --enable-rule=SHARED_CORE --enable-module=so --enable-shared=max --enable-so --with-mpm=worker --enable-rewrite --enable-file-cache --enable-cache --enable-cern-meta --enable-headers


--prefix=/usr/local/apache2 : apache 서버프로그램이 설치될 디렉토리 지정
--enable-so : PHP와 연동을 위한 지정.
--enable-modules=so : Tomcat connecter, PHP 등 so 확장자를 가진 파일들읜 모듈을 아파치에 로딩 시킬수 있게 한다.
--enable-headers : IE6과 쿠키에 관련된 옵션이다. IE6으로 버전 업이 되면서 각각의 프레임에서 쿠기를 구울 수 없게 되었다. 이것을 지원해 주는것
--enable-rewrite : SeverConfig, VirtualHost Directory, Htaccesscess를 설정하기 위한 옵션

#make
#make install



--부팅 관련 아파치 재시동 정의

cp -p /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd

ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S85httpd
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S85httpd



시스템 종료 및 재부팅 설정


ln -s /etc/rc.d/init.d/apachectl /etc/rc.d/rc0.d/K15httpd
ln -s /etc/rc.d/init.d/apachectl /etc/rc.d/rc1.d/K15httpd
ln -s /etc/rc.d/init.d/apachectl /etc/rc.d/rc6.d/K15httpd


vi /usr/local/apache2/conf/httpd.conf
다음 라인 추가
AddType application/x-httpd-php .php .phtml .php3 .php4 .php5
AddType application/x-httpd-php-source .phps


// 필요에 따라서 주석은 풀어 준다. (개별적으로 관리가 되어지는것 같다.)

# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf
# Multi-language error messages
Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
Include conf/extra/httpd-autoindex.conf
# Language settings

Include conf/extra/httpd-languages.conf //여기서 언어 우선순위를 잡아준다
/usr/local/apache2/conf/extra/httpd-languages.conf
LanguagePriority 변경 : ko 를 제일 앞으로...
AddDefaultCharset 을 EUC-KR 로... <= 이것도 추가해야 한다고 하지만


본인이 해본 결과 UTF-8 로 되어진 내용은 한글이 깨진다.. 그래서 삭제(없어도 잘된다.)
본인만 잘될수도 있으니.. ^.^ 한글 문제는 설치 다하고 잡아도 된다.걱정하지 말자..



# User home directories
Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf


4)php-5.1.4.tar.gz

#wget http://ie.php.net/distributions/php-5.1.4.tar.gz
#tar xvzf php-5.1.4.tar.gz
#cd php-5.1.4

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-sybase=/usr/local/freetds --with-config-file-path=/usr/local/lib --with-mysql=/usr/local/mysql --with-gd=/usr/local/gd --enable-gd-native-ttf --with-freetype-dir=/usr --with-zlib --with-iconv  --with-imap-ssl --with-kerberos --enable-mbstring --enable-tack-vars --enable-ftp --disable-debug --enable-sockets --with-language=korean --with-charset=euc_kr --with-mod_charset --with-mpm=worker --enable-maintainer-zts --enable-sysvsem --enable-sysvshm --with-config-file-path=/usr/local/apache2/conf --with-libxml-dir=/usr/local/include/libxml2 --with-xml


--prefix=/usr/local/php // php 설치될 위치
--with-apxs2=/usr/local/apache2/bin/apxs // apache-2.x 설정 (apache-1.x 이면 --with-apxs= <=이렇게 해준다).
--with-sybase=/usr/local/freetds // windows+mssql6.0 연결설정 (설치 해본결과 잘 된다).
--with-mysql=/usr/local/mysql // mysql 설정
--with-libxml-dir=/usr/local/include/libxml2 // libxml2 설정(설치시 이게 문제다.) 에러가 발생 할거다. libxml2 업데이트는 내용은 밑에 있음


(libxml2 이외의 부분에서 에러 발생 하면 모두 업데이트 해주자. php5 쓰지 말까.. -.-; )

php5 설치에 필요한 업데이트 부분

-------------------------------------------------------------------------------------------------
★ zlib , libpng, freetype, libjpeg, gd 설치
Zlib 깔기 #/usr/local/zlib
#wget http://www.gzip.org/zlib/zlib-1.2.1.tar.gz // zlib파일 다운로드
#tar -xzvf zlib-1.2.1.tar.gz // 압축해제
#cd zlib-1.2.1 // 압축해제된 폴더로 이동
#./configure --prefix=/usr/local/zlib // 컴파일 환경설정
#make
#make install

libpng 깔기 #/usr/local <= 디폴트 디렉토리
#wget -1.2.8.tar.gz
#tar -xzvf libpng-1.2.8.tar.gz
#cd libpng-1.2.8
#cp scripts/makefile.linux makefile //make파일내 zlib경로 설정해줘야함
#make
#make install

freetype 설치하기 #/usr/local/freetype
#wget http://nchc.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.9.tar.gz

#tar -xzvf freetype-2.1.9.tar.gz
#cd freetype-2.1.9
#./configure --prefix=/usr/local/freetype
#make
#make install

libjpeg 설치하기 # /usr/local
#wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
#tar -xzvf jpegsrc.v6b.tar.gz
#cd jpeg-6b
#./configure --enable-shared --enable-static
#make
#mkdir /usr/local/man/man1
#make install
#make test
#make install

gd설치하기 # /usr/local/gd
#wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
#tar -xzvf gd-2.0.33.tar.gz
#cd gd-2.0.33
#./configure --prefix=/usr/local/gd
#make
#make install





-------------------------------------------------------------------------------------

libxml2 에러 발생시

php ./configure .... 도중

아래와 같은 에러 발생 하면
-----------------------------------------------------

checking libxml2 install dir... no
configure: error: libxml2 version 2.6.11 or greater required.

-----------------------------------------------------
이럴 경우
libxml2관련 사항을 업그레이드 (Fedora2 기준임)
----------------

반드시 운영체제 버전에 맞는 libxml2 업그레이드를 해야 한다.

http://www.rpmfind.com/ <= 여기에서 운영체제에 맞는 libxml2 찾는다..

다른 운영체제 libxml2-rpm 을 설치하면 의존성 문제로 설치가 안된다.

--------------------

http://www.rpmfind.com/

각종 rpm 이 많이 있다 맨 밑에 검색을 통해 rpm 을 찾자
(반드시 운영체제를 확인 한후 rpm 을 설치 .. 의존성을 해결 할수 있으면 맘대로 설치 해도 괜찮음)
---------------------
우선 기존에 설치 되어 있는 RPM 확인해본다

rpm -qa | grep libxml2

libxml2-devel-2.6.8-1
libxml2-python-2.6.8-1
libxml2-2.6.8-1

있다..

삭제 하자.

rpm -e --nodeps libxml2-devel-2.6.8-1
rpm -e --nodeps libxml2-python-2.6.8-1
rpm -e --nodeps libxml2-2.6.8-1


http://www.rpmfind.com/ <= 여기에서 검색한 rpm 으로 설치 한다.
(다른 곳에서도 다운 받아도 가능-운영체제용 버전만 잘 맞추거나 의존성 해결할수 있으면 상관없다.)

rpm -Uvh libxml2-2.6.16-2.i386.rpm
rpm -Uvh libxml2-devel-2.6.16-2.i386.rpm
rpm -Uvh libxml2-python-2.6.16-2.i386.rpm


만약에 다른 버전용 선택하여 설치시

libxml2-python-2.6.16-2.i386.rpm 설치가 안되고

-------------------------
/usr/local/libxml2.2 ~~~~ 이상한 에러가 뜬다.. 자세한 에러 메신지는 .. 깜박하고 복사 안해놔서 -.-;;
-------------------------

에러가 없으면 rpm 설치 완료 다시

php

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-sybase=/usr/local/freetds --with-config-file-path=/usr/local/lib --with-mysql=/usr/local/mysql --with-gd=/usr/local/gd --enable-gd-native-ttf --with-freetype-dir=/usr --with-zlib --with-iconv --with-imap-ssl --with-kerberos --enable-mbstring --enable-tack-vars --enable-ftp --disable-debug --enable-sockets --with-language=korean --with-charset=euc_kr --with-mod_charset --with-mpm=worker --enable-maintainer-zts --enable-sysvsem --enable-sysvshm --with-config-file-path=/usr/local/apache2/conf --with-libxml-dir=/usr/local/include/libxml2 --with-xml

make
make install

cp ./php.ini-dist /etc/php.ini


# vi /usr/local/etc/apache2/httpd.conf

LoadModule php5_module libexec/apache2/libphp5.so <= 있으면 설치 완료


5)ZendOptimizer-3.0.0-linux-glibc21-i386.tar.gz



http://downloads.zend.com/optimizer/3.0.1/  < 다운받기


tar xvzf ZendOptimizer-3.0.0-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.0.0-linux-glibc21-i386
./install.sh

//////////////////////
엔터를 잘 눌러 준다..
//////////////////////

설치 끝.

------------------------------------------------------------------------------------
확인 사항

/usr/local/apache2/bin/httpd -t //http.conf 문법 에러 확인

error .... httpd-vhosts.conf <= 여기에서 에러 나면



vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
수정한다
아래와 같은 내용만 있어도 작동 완료


NameVirtualHost 192.168.0.10:80 <= 서버 아이피 주소

<VirtualHost 192.168.0.10:80>
ServerName localhost.localdomain
DocumentRoot /home/web/ <= 웹폴더를 정의 해준다.
</VirtualHost>


계속 에러 구문이 발생하면
vi /usr/local/apache2/conf/http.conf 에서 아래와 같은
Include conf/extra/httpd-userdir.conf <= Include ... 시작하는 부분을 모두 주석 처리 한다.


# /usr/local/apache2/bin/httpd -t
Syntax OK <= 이게 나오면 정상


#/usr/local/apache2/bin/apachectl start

cd /home/web

//////////
vi a.php
<?
phpinfo();
?>
////////


-mssql 연결




vi mssql2.php


mssql6.0 주소 =>192.168.10.2
mssql6.0 포트 =>4531
id =>test
pw =>test
DB =>test01


<?
$conn = mssql_connect("192.168.10.2:4531","test","test") or die("MsSQL 서버 연결 에러");
mssql_select_db("test01",$conn) or die("DB 오픈 에러");

$sql= "SELECT * FROM testS";
$rs= mssql_query ($sql, $conn);
while(!($row = mssql_fetch_array($rs))==null)
{
echo "cu_no >$row[NO]<br>";
echo "cu_id >$row[ID]<br>";
//echo "cu_seq >$row[SEQ]<br>";
//echo "cu_nm_kor >$row[KOR]<br>";
//echo "cu_nm_eng >$row[ENG]<br>";
}
mssql_close ($conn);
?>