Mac OS X에는 PHP를 미리 컴파일하여 만들어 놓은 패키지가 매우 적다.
이것은 표준적인 설정을 사용한 경우에는 도움이 되지만,
보안 서버나 별도의 데이타베이스 드라이버등의 좀 특별한 기능을 필요로 한다면,
php 혹은 웹서버까지도 새로 컴파일하여 만들 필요가 있다.
만일 컴파일작업에 익숙치 않다면, 기존에 만들어진 패키지중에
여러분이 원하는 기능을 포함하고 있는 패키지가 있는가 찾아보는 것이 좋을 것이다.
Mac OS X에는 서버와 클라이언트의 약간 다른 두가지 버젼이 있는데,
여기에서는 서버 버젼을 대상으로 설명한다.
예 3-4. Mac OS X 서버에서의 설치 1. 최근의 Apache 와 PHP의 배포판을 받는다.
2. 위에서 다운받은 것들을 Untar 하고, 아파치에서 다음과 같이 설정 프로그램을 실행 한다.
./configure --exec-prefix=/usr \
--localstatedir=/var \
--mandir=/usr/share/man \
--libexecdir=/System/Library/Apache/Modules \
--iconsdir=/System/Library/Apache/Icons \
--includedir=/System/Library/Frameworks/Apache.framework/Versions/1.3/Headers \
--enable-shared=max \
--enable-module=most \
--target=apache
4. 컴파일시 최적화를 실행하고자 한다면, 다음과 같은 라인을 첨가하도록 한다.
setenv OPTIM=-O2
5. 이제 PHP4 소스 디렉토리로 이동하여 PHP를 설정한다.
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/share/man \
--with-xml \
--with-apache=/src/apache_1.3.12
만약 다른 추가적인 모듈(MySQL, GD 등)을 사용한다면,
당연히그것들도 여기서 첨가하여야 한다.
--with-apache 옵션에는 "/src/apache_1.3.12" 같이 아파치 소스
디렉토리의 경로가 지정되어야 한다.
6. make
7. make install
이것은 아파치 소스 디렉토리밑에 src/modules/php4라는 디렉토리를
추가 한다.
8. Now, reconfigure Apache to build in PHP 4.
이제 PHP4를 사용하도록 아파치를 재설정한다.
./configure --exec-prefix=/usr \
--localstatedir=/var \
--mandir=/usr/share/man \
--libexecdir=/System/Library/Apache/Modules \
--iconsdir=/System/Library/Apache/Icons \
--includedir=/System/Library/Frameworks/Apache.framework/Versions/1.3/Headers \
--enable-shared=max \
--enable-module=most \
--target=apache \
--activate-module=src/modules/php4/libphp4.a
아마 libmodphp4.a 가 날짜가 경과되었다는(out of date) 메세지가 나올 지 모른다.
이런 경우 아파치 소스 디렉토리의 src/modules/php4 디렉토리로 이동하여
다음과 같은 명령을 실행한다. :
ranlib libmodphp4.a
이제 아파치 소스 디렉토리의 root로 다시 돌아가서, 위에 적은 설정 명령을 다시 실행한다.
위의 명령은 링크 테이블을 재 설정하는 명령이다.
9. make
10. make install
11. 다음과 같이 php.ini-dist 파일을 PHP4 소스 디렉토리에서 여러분의 "bin"
디렉토리로 복사하고, php.ini 로 이름을 바꾼다. :
cp php.ini-dist /usr/local/bin/php.ini
혹은 (local 디렉토리가 없다면)
cp php.ini-dist /usr/bin/php.ini |
|
Mac OS X client와
Mac OS X server에 대한
다른 예는 Stepwise에서 찾을 수 있다.
Those tips are graciously provided by Marc Liyanage.
The PHP module for the Apache web server included in Mac OS X.
This version includes support for the MySQL and PostgreSQL databases.
NOTE: Be careful when you do this, you could screw up your Apache web server!
Do this to install:
1. Open a terminal window
2. Type "wget http://www.diax.ch/users/liyanage/software/macosx/libphp4.so.gz",
wait for download to finish
3. Type "gunzip libphp4.so.gz"
4. Type "sudo apxs -i -a -n php4 libphp4.so"
Now type "
sudo open -a TextEdit /etc/httpd/httpd.conf"
TextEdit will open with the web server configuration file. Locate these
two lines towards the end of the file: (Use the Find command)
#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps |
Remove the two hash marks (
#), then save the file and quit TextEdit.
Finally, type "sudo apachectl graceful" to restart the web server.
PHP should now be up and running. You can test it by dropping a file into
your "Sites" folder which is called "test.php". Into that file, write this
line: "<?php phpinfo() ?>".
Now open up 127.0.0.1/~your_username/test.php in your web browser.
You should see a status table with information about the PHP module.