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
- 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
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!
- ./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
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!
沒有留言:
張貼留言