Category Archives: PHP

Linux #19 : Installation Apache + PHP + Subversion

PHP개발을 위해 Apache와 Subversion을 구축 할 때 사용했던 App와 설치 옵션 들입니다.

SQLite
Link : http://www.sqlite.org/
Current Source version : 3.6.15

$ ./configure
$ make;make install

Linux(RHEL)에 설치된 Version을 사용해도 되고 Source Version을 별도로 설치해서 사용해도 됩니다.

BDB (Berkeley DB)
Link : http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html
Current Source version : 4.7.25

$ cd $BASE/build_unix
$ ../dist/configure --prefix=/usr/local
$ make install

Apr과 Apr-util은 다른 이것 저것들을 해보기 위해서 설치 했습니다. 개인적으로 App들을 개별적인 Directory에 관리하는 걸 선호해서 prefix를 일일이 설정 해 주기도 합니다.

Apr
Link : http://apr.apache.org/
Current Source version : 1.3.5

$ ./configure --prefix=/usr/local/apr

Apr-util
Link : http://apr.apache.org/
Current Source version : 1.3.7

$ ./configure --prefix=/usr/local/apr --with-berkeley-db=/usr/local/lib --with-apr=/usr/local/apr --with-ldap

Apache
Link : http://httpd.apache.org/
Current Source version : 2.2.11

$ ./configure --prefix=/usr/local/apache2 --enable-proxy --enable-proxy-http --enable-proxy-balancer --enable-dav --enable-rewrite --enable-deflate --enable-headers --enable-logio --enable-expires --enable-so --with-berkeley-db=/usr --with-expat=builtin --with-ldap --enable-authnz-ldap=shared --enable-ldap=shared --with-ssl=/usr --enable-ssl --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr

Subversion
Link : http://subversion.tigris.org/
Current Source version : 1.6.3

$ ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --with-berkeley-db=db.h:/usr/local/include:/usr/local/lib:db-4.7 --with-sqlite=/usr/local/sqlite --with-neon=/usr/local --with-ssl

PHP
Link : http://www.php.net/
Current Source version : 5.2.8

$ ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local//mysql --with-gd --with-pear --with-ldap --enable-sysvsem --enable-sysvshm --enable-sysvmsg --with-gettext --with-curl -enable-gd-native-ttf --with-pic --enable-wddx --with-kerberos --with-mcrypt --enable-mbstring --enable-sockets --with-freetype-dir --with-jpeg-dir --with-snmp --enable-ucd-snmp-hack --enable-pcntl --with-zlib

혹 compile이 안되고 아래와 같은 Error가 있을 경우, libtool-ltdl을 설치합니다.

/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
$ yum install libtool-ltdl.x86_64 libtool.x86_64 or libtool-ltdl.i386 libtoolxi386

그럼, 이제 PHP와 Subversion을 사용하기 위한 Apache를 설정합니다.

PHP 관련 설정

$ vi /usr/local/apache2/conf/httpd.conf
..
# PHP
Include conf/extra/httpd-php.conf
..
$ vi /usr/local/apache2/conf/extra/https-php.conf
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
LoadModule php5_module modules/libphp5.so
#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps

Subversion관련 설정

$ vi /usr/local/apache2/conf/httpd.conf
..
# SVN
Include conf/extra/httpd-svn.conf
..
$ vi /usr/local/apache2/conf/extra/https-svn.conf
DAV svn
SVNPath /home/www/svn/project1
# Apache의 authentication을 사용할 경우
AuthType Basic
AuthName "Secure Area"
AuthUserFile /usr/local/apache2/.htaccess
Require valid-user jeff

.htaccess File을 생성할 필요가 있으므로 아래와 같이..

$ /usr/local/apache2/bin/htpasswd -c /usr/local/apache2/.htaccess jeff
New password:

SVN과 관련 된 Repository를 생성 한다. 위 설정대로라면

$ svnadmin create /home/www/svn/project1

이후 WebDAV를 경유해서 Repository에 접근 할 시 아래와 같은 에러가 발생 한다면


Could not open the requested SVN filesystem

$ tail -f /usr/local/apache2/log/error_log
(20014)Internal error: SQLite compiled for 3.6.15, but running with 3.3.7
Could not fetch resource information. [500, #0]
Could not open the requested SVN filesystem [500, #200030]
Could not open the requested SVN filesystem [500, #200030]

이는 PHP를 먼저 설치하고 Subversion을 설치 할 경우 아래와 같은 Error가 나는 경우가 있는데, 이는 /usr/local/apache2/modules/mod_dav_svn.so이 SQLite의 3.6.15가 설치되었음에도 불구하고 3.3.7을 보고 있는 경우로 PHP Module인 libphp5.so가 입력되어 있으면 libphp5.so로 인해 Subversion을 도입시에 같은 오래된 library를 link해 버리는 문제가 있습니다.
따라서 PHP Module을 comment 처리 한 후에 Subversion을 재설치하면 해결이 됩니다.