PHP PHP5와 Zend 컴파일 A to Z
페이지 정보
본문
mySQL : https://www.happyjung.com/bbs/board.php?bo_table=lecture&wr_id=782
Apache : https://www.happyjung.com/bbs/board.php?bo_table=lecture&wr_id=784
GD설치 : https://www.happyjung.com//bbs/board.php?bo_table=lecture&wr_id=235
PHP5 : ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 본문참고 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
1. libzml2 설치
가능하면 [ 방법2 ]를 이용하세요.
[ 방법1 ]
1-1. rpm 설치된 libxml2 확인후 삭제
[root@localhost gd-2.0.33]# cd /usr/local
[root@localhost local]# rpm -qa | grep libxml2
libxml2-2.6.16-12
libxml2-python-2.6.16-12
[root@localhost local]# rpm -e --nodeps libxml2-2.6.16-12
[root@localhost local]# rpm -e --nodeps libxml2-python-2.6.16-12
1-2. libxml2 설치
[root@localhost local]# wget ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz
[root@localhost local]# tar zxvfp libxml2-2.7.3.tar.gz
[root@localhost local]# cd libxml2-2.7.3
[root@localhost libxml2-2.7.3]# ./configure --prefix=/usr/local/libxml2
[root@localhost libxml2-2.7.3]# make
[root@localhost libxml2-2.7.3]# make install
[root@localhost libxml2-2.7.3]# make clean
[root@localhost libxml2-2.7.3]# cp /usr/local/libxml2/lib/libxml2.so.2.7.3 /usr/local/lib
[root@localhost libxml2-2.7.3]# cd /usr/local/lib
[root@localhost lib]# ln -s libxml2.so.2.7.3 libxml2.so
[root@localhost lib]# ln -s libxml2.so.2.7.3 libxml2.so.2
[root@localhost lib]# cd ..
[ 방법2 ]
[root@localhost local]# yum install libxml2-devel
2. PHP 다운로드
[root@localhost local]# wget http://museum.php.net/php5/php-5.1.6.tar.gz
[root@localhost local]# wget http://museum.php.net/php5/php-5.2.9.tar.gz
[root@localhost local]# wget http://kr.php.net/get/php-5.2.11.tar.gz/from/kr.php.net/mirror
[root@localhost local]# wget http://kr.php.net/get/php-5.3.3.tar.gz/from/kr.php.net/mirror
[root@localhost local]# tar zxvfp php-5.2.9.tar.gz
[root@localhost local]# cd php-5.2.9
3. PHP 컴파일
[root@localhost php-5.2.9]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --disable-debug --enable-sockets --enable-calendar --enable-sysvsem=yes --enable-sysvshm=yes --enable-ftp --enable-magic-quotes --enable-gd-native-ttf --enable-bcmath --with-jpeg-dir=/usr/lib --with-png-dir --with-zlib --with-jpeg-dir=/usr --with-png-dir=/usr/lib --with-freetype-dir=/usr --with-libxml-dir=/usr/local/libxml2 --enable-exif --with-gd --with-ttf --with-gettext --enable-sigchild --enable-mbstring
prefix 지정하지 않는경우에는 /usr/local/lib/php 에 설치됩니다.
5. 컴파일 오류시 대처하기
5-1. configure: error: xml2-config not found. Please check your libxml2 installation. 에러날때
[root@localhost php-5.2.9]# yum install libxml2-devel
5-2. configure: error: Please reinstall the BZip2 distribution 에러날때
해결책 :
[root@localhost local]# wget ftp://sources.redhat.com/pub/bzip2/v102/bzip2-1.0.2.tar.gz
Bzip2팩키지는 configure script가 없습니다. option을 한줄로 써서 컴파일 하고 설치합니다.
[root@localhost local]# cd bzip2-1.0.2
[root@localhost bzip2-1.0.2]# make PREFIX=/tools install
[root@localhost bzip2-1.0.2]# make clean
[root@localhost bzip2-1.0.2]# cd ../php-5.2.9
5-3. configure: error: libXpm.(a|so) not found 에러날때
[root@localhost php-5.2.9]# yum install xorg-x11-devel
5-4. configure: error: mcrypt.h not found. Please reinstall libmcrypt. 에러날때
[root@localhost php-5.2.9]# cd ..
[root@localhost local]# wget http://ftp.linux.co.kr/pub/etc/libmcrypt-2.5.7.tar.gz
[root@localhost local]# tar zxvfp libmcrypt-2.5.7.tar.gz
[root@localhost local]# cd libmcrypt-2.5.7
[root@localhost libmcrypt-2.5.7]# ./configure && make && make install
[root@localhost libmcrypt-2.5.7]# cd ../php-5.2.9
5-5. /usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1 오류가 날때
[root@localhost php-5.2.9]# cd ..
[root@localhost local]# wget http://ftp.gnu.org/gnu/libtool/libtool-2.2.6a.tar.gz
[root@localhost local]# cd libtool-2.2.6
[root@localhost libtool-2.2.6]# ./configure
[root@localhost libtool-2.2.6]# make
[root@localhost libtool-2.2.6]# make install
[root@localhost libtool-2.2.6]# cd ../php-5.2.9
5-6. Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/ChannelFile.php on line 1400
http://www.pear-forum.org/post-5065.html
6. PHP 설치
[root@localhost php-5.2.9]# make
[root@localhost php-5.2.9]# make test
[root@localhost php-5.2.9]# make install
[root@localhost php-5.2.9]# make clean
7. php 환경설정 파일 복사
<주의>
[root@localhost php-5.2.9]# cp php.ini-dist /etc/php.ini ( x )
위의 경로에 복사하면 Zend 설치오류발생하므로 가급적 아래 경로를 사용하세요.
[root@localhost php-5.2.9]# cp php.ini-dist /usr/local/lib/php.ini ( o )
8. PHP 확장자 옵션 추가
8-1. 아파치 설정파일 수정
[root@localhost php-5.2.9]# vi /usr/local/apache/conf/httpd.conf
...
LoadModule php5_module modules/libphp5.so # 있는지 확인후 없으면 추가
...
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php # index.htm index.php 추가
</IfModule>
...
<IfModule mime_module>
# php 관련 2줄 추가
AddType application/x-httpd-php .php .php3 .php4 .ph .phtml .html .htm .inc
AddType application/x-httpd-php-source .phps
...
8-2. 아파치 stop 후 start
[root@localhost php-5.2.9]# /usr/local/apache/bin/apachectl stop
[root@localhost php-5.2.9]# /usr/local/apache/bin/apachectl start
[root@localhost php-5.2.9]# vi ~/.bash_profile
...
PATH=$PATH:$HOME/bin:/usr/lib:/user/local/mysql/bin:/usr/local/apache/bin:/usr/local/php/bin
...
[root@localhost php-5.2.9]# source ~/.bash_profile
8-3. 웹브라우저에서 php 페이지 테스트
[root@localhost php-5.2.9]# vi /home/wmater/html/test.php
<? phpinfo(); ?>
9. Zend 설치
http://www.zend.com 에서 ZendOptimizer 다운로드
9-1. ZendOptimizer-3.3.3 설치하기 ( 다운로드 : http://yyman.tistory.com/116 )
[root@localhost php-5.2.9]# cd /usr/local
[root@localhost local]# wget http://yyman.tistory.com/attachment/cfile21.uf@11149F114A70BAE91DAE82.gz
[root@localhost local]# tar zxvfp 11149F114A70BAE91DAE82
[root@localhost local]# cd ZendOptimizer-3.3.3-linux-glibc23-i386
[root@localhost ZendOptimizer-3.3.3-linux-glibc23-i386]# ./install.sh
자동설치후
[root@localhost ZendOptimizer-3.3.3-linux-glibc23-i386]# cd /usr/local/php/lib
[root@localhost lib]# ln -s /usr/local/Zend/etc/php.ini
9-2. ZendOptimizer-3.3.9 설치하기
참고 : http://blog.naver.com/01191879872?Redirect=Log&logNo=10070903354
9-3. 설정
[root@localhost lib]# vi /usr/local/Zend/etc/php.ini
...
register_globals = Off --> On
post_max_size = 8M --> 30M
upload_max_filesize = 2M --> 30MB
;ssession.save_path = "/tmp" --> ssession.save_path = "/tmp" # 앞에 ; 를 삭제
...
[root@localhost lib]# /usr/local/apache/bin/apachectl stop
[root@localhost lib]# /usr/local/apache/bin/apachectl start
모든 설치가 끝났습니다.
# cd /home/wmaster/html
# vi test.php
<? phpinfo(); ?>
[실패]
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
[성공]
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
10. php.ini 설정변경
[root@localhost lib]# vi /usr/local/Zend/etc/php.ini
...
allow_url_fopen = On --> Off
...
[root@localhost lib]# /usr/local/apache/bin/apachectl restart
allow_url_fopen = On으로 설정하면 파일 엑세스시 외부 사이트의 파일을 호출할수 있습니다.
특히 include(), require() 계열의 함수 사용시 심각한 보안상 문제를 유발할수 있습니다.
php injection 과 관련이 있습니다.
2010-11-10 17:53
php 컴파일 옵션추가
--with-openssl
2010-11-10 21:19
OpenSSL 컴파일
# w get http://www.openssl.org/source/openssl-1.0.0a.tar.gz
# tar xvfz openssl-1.0.0a.tar.gz
# ./config --openssldir=/usr/local/openssl no-asm threads no-shared
# make
# make test
# make install
참고자료
http://blog.naver.com/norther80/80010370985
http://jis.pe.kr/road/entry/리눅스-APM-소스설치시-에러에-대한-대처
네이버 지식인 (smson92 님)
http://yyman.tistory.com/116
http://tong.nate.com/ko1047/23998133
http://www.phpkorea.org/archives/305
http://blue.iegate.net/ver4/bbs/board.php?bo_table=plus03&wr_id=189
http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=46636
http://blog.daum.net/aswip/8429618
댓글목록
등록된 댓글이 없습니다.