How to install apache 2.2.16 with PHP 5.3.3 on FreeBSD 6.4 - 吉姆的電腦閣誌

吉姆的電腦閣誌

HTML5,Jquery,PHP,FreeBSD分享教學。電腦是用來節省時間及提升樂趣,不是用來把人綁住的。隨心而行,順著生命的脈動重新創造屬於自己的生活。

Breaking

Home Top Ad

Responsive Ads Here

Post Top Ad

Responsive Ads Here

2010-08-14

How to install apache 2.2.16 with PHP 5.3.3 on FreeBSD 6.4

在FreeBSD環境安裝Apache Web Server搭配PHP,這是之前寫的筆記,放上來比較安心。

 I spent much time to install httpd 2.x compiled with PHP 5.x, but have never done with it.
 Finally, I make out how to do it , and would like to share with you. Hope to help someone
 with saving time to do it.

My Envirement:
#FreeBSD 6.4-RELEASE-p10 with MySQL 4.1

DOWNLOAD SOURCESES:


Here we go:

1.Prepare the  sources ( I specify "/use/local/src" for placing the sources)




  • tar -jxvf httpd-2.2.16.tar.bz2 -C /usr/local/src
  • tar -jxvf php-5.3.3.tar.bz2 -C /usr/local/src
 2.Install Apache



  • cd /usr/local/src/httpd-2.2.16/
  • ./configure --prefix=/usr/local/apache2  --enable-mods-shared=all  --enable-threads \
    --sysconfdir=/usr/local/etc/apache2 --enable-modules="ext_filter" --enable-suexec \
    --with-suexec-caller --with-suexec-bin=/usr/local/bin/suexec \
    --with-suexec-logfile=/var/log/suexec_log --with-suexec-userdir=cgi-bin --enable-cgi \
    -enable-vhost-alias --enable-rewrite --enable-so \
    --with-mpm=prefork --with-suexec-bin=/usr/local/bin
  • make
  • make install
    (Simply type " make clean all install" if you are in a hurry, and now you can start httpd server  by excuting "/usr/local/apache/bin/apachectl start" to see if it works.)

3.Intall PHP


  • ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-pear --with-tsrm-pth \
    --with-mysql  --with-mssql=/usr/local --with-msql=/usr/local/msql3 --with-unixODBC \
     --with-gd --with-zlib --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib  \
     --with-bz2=/usr/lib  --with-curl=/usr/local/bin/curl --with-gettext=/usr/local/lib \
     --with-freetype-dir=/usr/local/share/fonts/TrueType --with-iconv=/usr/local/include \
     --enable-dba --enable-dbase --enable-dio  --enable-bcmath --enable-cli --enable-fastcgi \
     --enable-calendar --enable-magic-quotes --enable-zend-multibyte \
     --enable-ftp --enable-filepro --enable-track-vars --enable-versioning --enable-mbregex --enable-mbstring \
     --enable-mbstr-enc-trans --enable-ucd-snmp-hack --disable-debug  --disable-ipv6
  • make
  • make install
 4.Edit httpd.conf


vi /usr/local/apache/conf/httpd.conf

We can activate file extension for PHP filetype via 2 methods:

a)
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
b)
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>

5.Test
Put a file named "test.php" in "/usr/local/apache/htdocs" .
Modify test.php and make it like below:

<?
phpinfo();
?>

Open your browser and visit http://yourdomain/test.php, and it works!

沒有留言:

Post Bottom Ad

Responsive Ads Here

Pages