Chinaunix首页 | 论坛 | 博客
  • 博客访问: 621257
  • 博文数量: 139
  • 博客积分: 826
  • 博客等级: 少校
  • 技术积分: 1367
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-25 17:30
文章分类

全部博文(139)

文章存档

2016年(2)

2015年(2)

2014年(1)

2012年(15)

2011年(41)

2007年(33)

2006年(45)

分类: BSD

2011-07-04 21:39:53

 OpenBSD Apache2 mysql PHP环境搭建
安装Mysql server
代码:
# export PKG_PATH=ftp://
# pkg_add mysql-server
mysql-server-5.1.48:mysql-client-5.1.48: ok
mysql-server-5.1.48:p5-Net-Daemon-0.43: ok
mysql-server-5.1.48:p5-PlRPC-0.2018p0: ok
mysql-server-5.1.48:p5-DBI-1.609: ok
mysql-server-5.1.48:p5-DBD-mysql-4.014: ok
mysql-server-5.1.48: ok
--- +mysql-server-5.1.48 -------------------
You can find detailed instructions on how to install a database
in /usr/local/share/doc/mysql/README.OpenBSD.
#
创建默认的数据库:
代码:
# /usr/local/bin/mysql_install_db
Installing MySQL system tables...
110307 13:36:00 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
Filling help tables...
110307 13:36:00 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/bin/mysqladmin -u root password 'new-password'
/usr/local/bin/mysqladmin -u root -h jr.gateway.2wire.net password 'new-password'

Alternatively you can run:
/usr/local/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/local/bin/mysqlbug script!

#
运行Mysql
代码:
# mysqld_safe &
[1] 8078
# 110307 13:37:44 mysqld_safe Logging to '/var/mysql/jr.gateway.2wire.net.err'.
110307 13:37:44 mysqld_safe Starting mysqld daemon with databases from /var/mysql

#
设定本地mysql的root密码
代码:
# mysqladmin -u root password 'jiarun.org'
创建Mysql配置文件
代码:
# cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
要让数据库的字符集编码默认是UTF-8,还要修改一下/etc/my.cnf文件,必须包含如下的内容:
代码:
[client] default-character-set=utf8 [mysqld] default-character-set=utf8 init_connect='SET NAMES utf8'
此外基本设置里的(修改为自己觉得合适的大小)
代码:
max_allowed_packet = 1M
建立Mysql登录级别
代码:
mysql:\ :openfiles-cur=1024:\ :openfiles-max=2048:\ :tc=daemon:
然后重建login.conf.db文件
代码:
# cap_mkdb /etc/login.conf
重新启动系统后建立一个数据库
代码:
# mysql -p
Enter password:jiarun
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.48-log OpenBSD port: mysql-server-5.1.48
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>CREATE DATABASE `jiarunorg` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
分配用户leo具有数据库jiarunorg的所有权限,操作是本地,密码为jiarun:
代码:
mysql> grant all on jiarunorg.* to leo@localhost identified by 'jiarun'; Query OK, 0 rows affected (0.00 sec)
这里注意,论坛真正运行时并不需要全部的权限,安装完成后读者请根据自己所用软件的要求来自行消减该用户权限。
退出mysql
代码:
mysql> quit Bye #
安装apache2
代码:
# export PKG_PATH=ftp://
# pkg_add apache-httpd
apache-httpd-2.2.15:pcre-8.02p1: ok
apache-httpd-2.2.15:apr-mt-1.2.11p4: ok
apache-httpd-2.2.15:db-4.6.21p0: ok
apache-httpd-2.2.15:libiconv-1.13p1: ok
apache-httpd-2.2.15:apr-util-mt-1.2.10p4: ok
apache-httpd-2.2.15: ok
--- +apache-httpd-2.2.15 -------------------
This is the official httpd distributed by the Apache Server Project,
provided as a port for those who, for various reasons, need to run
version 2.

OpenBSD provides a custom Apache server, httpd(8), in the base system
which has been audited for security and may run in a chroot(2)
environment.  Users are STRONGLY encouraged to use the system httpd
rather than this port.
#
如果想在OpenBSD系统启动时自动运行Apache2,在/etc/rc.local文件里加上如下两行:
代码:
echo "starting apache2..." /usr/local/sbin/apachectl2 start
apache2的主目录在 /var/apache2/htdocs/

到目前为止安装的pkckages
代码:
# pkg_info
apache-httpd-2.2.15 apache HTTP server
apr-mt-1.2.11p4     Apache Portable Runtime
apr-util-mt-1.2.10p4 companion library to APR
db-4.6.21p0         Berkeley DB package, revision 4
libiconv-1.13p1     character set conversion library
mysql-client-5.1.48 multithreaded SQL database (client)
mysql-server-5.1.48 multithreaded SQL database (server)
p5-DBD-mysql-4.014  MySQL drivers for the Perl DBI
p5-DBI-1.609        unified perl interface for database access
p5-Net-Daemon-0.43  extension for portable daemons
p5-PlRPC-0.2018p0   module for writing rpc servers and clients
pcre-8.02p1         perl-compatible regular expression library
#
安装php
Ports系统内PHP及其所有扩展全是为apache 1.3“量身定制”的,不过我们讨论的是apache2,所以如果直接使用pkg_add安装编译好的php内核和扩展,就会在运行apache2时遇到运行错误。这就需要自己动手修改ports了。
需要在以下两个文件内用CONFIGURE_ARG+来定义新的flag,
引用:
/usr/ports/www/php5/core/Makefile
/usr/ports/www/php5/extensions/Makefile
也就是将原来的
代码:
CONFIGURE_ARGS+= --with-apxs=/usr/sbin/apxs \
替换为
代码:
CONFIGURE_ARGS+= --with-apxs2=/usr/local/sbin/apxs2 \
有关CONFIGURE_AGS+的说明请参阅


设置工作已经结束了,现在我们的就需要手动编译php内核及其扩展了。
代码:
# cd /usr/ports/www/php5 # make install
上面的命令会按照我们的设定编译PHP内核以及所有的php扩展,如果你不想编译某些模块或者说想进行特殊的设定,自己在/usr/ports/www/php5 里运行
代码:
# make show=FLAVORS
我的实验系统是i386,所以生成的packages文件在 /usr/ports/packages/i386/all/ 里面


以下是packages清单:
代码:
# cd /usr/ports/packages/i386/all/
# ls -la
total 198548
drwxr-xr-x  2 root  wheel      4096 Mar  8 06:14 .
drwxr-xr-x  6 root  wheel       512 Mar  8 00:09 ..
-rw-r--r--  3 root  wheel   3073218 Mar  8 04:55 aspell-0.60.6p4.tgz
-rw-r--r--  3 root  wheel    217546 Mar  8 02:41 atk-1.30.0p0.tgz
-rw-r--r--  3 root  wheel    135835 Mar  8 00:35 autoconf-2.13p1.tgz
-rw-r--r--  3 root  wheel    402639 Mar  8 03:00 autoconf-2.59p3.tgz
-rw-r--r--  3 root  wheel    469093 Mar  8 00:10 autoconf-2.61p3.tgz
-rw-r--r--  3 root  wheel    512100 Mar  8 03:01 autoconf-2.62p0.tgz
-rw-r--r--  3 root  wheel    442692 Mar  8 03:00 automake-1.9.6p4.tgz
-rw-r--r--  3 root  wheel    121249 Mar  8 00:39 bzip2-1.0.5.tgz
-rw-r--r--  3 root  wheel   1951220 Mar  8 02:05 c-client-2007ep0.tgz
-rw-r--r--  3 root  wheel    724451 Mar  8 02:48 cairo-1.8.10p0.tgz
-rw-r--r--  3 root  wheel   3842543 Mar  8 03:13 cups-1.4.4p1.tgz
-rw-r--r--  3 root  wheel    560349 Mar  8 01:47 curl-7.20.0.tgz
-rw-r--r--  3 root  wheel    742646 Mar  8 02:08 cyrus-sasl-2.1.23p0.tgz
-rw-r--r--  3 root  wheel    595901 Mar  8 03:07 dbus-1.2.24p4.tgz
-rw-r--r--  3 root  wheel     44179 Mar  8 03:14 desktop-file-utils-0.16p0.tgz
-rw-r--r--  3 root  wheel   2068612 Mar  8 05:25 doxygen-1.5.4p0.tgz
-rw-r--r--  3 root  wheel   1768417 Mar  8 05:48 freetds-0.82.1pre20090903p0.tgz
-rw-r--r--  3 root  wheel     40895 Mar  8 00:46 gdbm-1.8.3p0.tgz
-rw-r--r--  3 root  wheel   7198703 Mar  8 00:35 gettext-0.18.1.tgz
-rw-r--r--  3 root  wheel   2782478 Mar  8 02:40 glib2-2.24.1p2.tgz
-rw-r--r--  4 root  wheel   1392936 Mar  8 02:40 glib2-docs-2.24.1.tgz
-rw-r--r--  3 root  wheel    157338 Mar  8 02:44 glitz-0.5.6p2.tgz
-rw-r--r--  3 root  wheel    453040 Mar  8 01:52 gmake-3.81p1.tgz
-rw-r--r--  3 root  wheel    539606 Mar  8 02:01 gmp-4.3.1.tgz
-rw-r--r--  3 root  wheel   1634143 Mar  8 05:44 gnutls-2.8.6.tgz
-rw-r--r--  3 root  wheel  12213825 Mar  8 04:20 gtk+2-2.20.1.tgz
-rw-r--r--  3 root  wheel     72462 Mar  8 04:20 gtk+2-cups-2.20.1.tgz
-rw-r--r--  4 root  wheel   2835824 Mar  8 04:20 gtk+2-docs-2.20.1.tgz
-rw-r--r--  3 root  wheel     10332 Mar  8 00:09 help2man-1.29p0.tgz
-rw-r--r--  4 root  wheel      4996 Mar  8 04:20 hicolor-icon-theme-0.12.tgz
-rw-r--r--  3 root  wheel   3047186 Mar  8 02:05 imap-uw-2007ep0.tgz
-rw-r--r--  4 root  wheel     43364 Mar  8 02:24 intltool-0.40.6.tgz
-rw-r--r--  3 root  wheel    589083 Mar  8 04:28 iodbc-3.52.6p0.tgz
-rw-r--r--  3 root  wheel    282328 Mar  8 04:28 iodbc-admin-3.52.6p0.tgz
-rw-r--r--  3 root  wheel    359913 Mar  8 01:49 jpeg-8b.tgz
-rw-r--r--  3 root  wheel     34816 Mar  8 00:45 lemon-3.6.23.tgz
-rw-r--r--  3 root  wheel     26221 Mar  8 02:26 libgamin-0.1.10p3.tgz
-rw-r--r--  3 root  wheel    661931 Mar  8 05:30 libgcrypt-1.4.6.tgz
-rw-r--r--  3 root  wheel     74979 Mar  8 05:26 libgpg-error-1.9.tgz
-rw-r--r--  3 root  wheel    270101 Mar  8 01:42 libidn-1.11.tgz
-rw-r--r--  3 root  wheel    386886 Mar  8 00:11 libltdl-1.5.26p0.tgz
-rw-r--r--  3 root  wheel    175524 Mar  8 02:21 libmcrypt-2.5.8p1.tgz
-rw-r--r--  3 root  wheel    114700 Mar  8 05:33 libtasn1-2.3.tgz
-rw-r--r--  3 root  wheel    259404 Mar  8 00:11 libtool-1.5.26p4.tgz
-rw-r--r--  3 root  wheel   2088255 Mar  8 01:08 libxml-2.7.6.tgz
-rw-r--r--  3 root  wheel    619281 Mar  8 05:52 libxslt-1.1.26.tgz
-rw-r--r--  3 root  wheel    131756 Mar  8 05:35 lzo2-2.03.tgz
-rw-r--r--  3 root  wheel    500205 Mar  8 02:05 mailutil-uw-2007ep0.tgz
-rw-r--r--  3 root  wheel      4095 Mar  8 00:09 metaauto-0.9.tgz
-rw-r--r--  3 root  wheel    262264 Mar  8 02:22 mhash-0.9.9.9.tgz
-rw-r--r--  3 root  wheel   2514379 Mar  8 05:10 net-snmp-5.4.2.1p5.tgz
-rw-r--r--  3 root  wheel      9072 Mar  8 05:10 net-snmp-tkmib-5.4.2.1.tgz
-rw-r--r--  3 root  wheel   1352579 Mar  8 02:19 openldap-client-2.3.43p1.tgz
-rw-r--r--  3 root  wheel    866423 Mar  8 02:19 openldap-server-2.3.43p3.tgz
-rw-r--r--  3 root  wheel    136776 Mar  8 05:10 p5-SNMP-5.4.2.1p1.tgz
-rw-r--r--  3 root  wheel     15662 Mar  8 04:32 p5-UUID-1.6.0p1.tgz
-rw-r--r--  3 root  wheel    189036 Mar  8 02:24 p5-XML-Parser-2.36p1.tgz
-rw-r--r--  3 root  wheel    983632 Mar  8 02:56 pango-1.28.1.tgz
-rw-r--r--  3 root  wheel     10642 Mar  8 06:12 php5-bz2-5.2.13p0.tgz
-rw-r--r--  3 root  wheel   3565325 Mar  8 01:40 php5-core-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     26432 Mar  8 06:12 php5-curl-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     24950 Mar  8 06:12 php5-dba-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     14732 Mar  8 06:12 php5-dbase-5.2.13p0.tgz
-rw-r--r--  3 root  wheel       949 Mar  8 06:12 php5-extensions-5.2.13p0.tgz
-rw-r--r--  3 root  wheel   1431450 Mar  8 01:40 php5-fastcgi-5.2.13p0.tgz
-rw-r--r--  3 root  wheel    111253 Mar  8 06:12 php5-gd-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     16459 Mar  8 06:13 php5-gmp-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     38184 Mar  8 06:13 php5-imap-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     19015 Mar  8 06:13 php5-ldap-5.2.13p0.tgz
-rw-r--r--  3 root  wheel   1104624 Mar  8 06:13 php5-mbstring-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     14196 Mar  8 06:13 php5-mcrypt-5.2.13p0.tgz
-rw-r--r--  3 root  wheel      5271 Mar  8 06:13 php5-mhash-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     22237 Mar  8 06:14 php5-mssql-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     24043 Mar  8 06:13 php5-mysql-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     41313 Mar  8 06:13 php5-mysqli-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     24927 Mar  8 06:13 php5-ncurses-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     27946 Mar  8 06:13 php5-odbc-5.2.13p0.tgz
-rw-r--r--  3 root  wheel      8264 Mar  8 06:14 php5-pdo_dblib-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     13548 Mar  8 06:13 php5-pdo_mysql-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     14171 Mar  8 06:13 php5-pdo_pgsql-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     11835 Mar  8 06:13 php5-pdo_sqlite-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     44269 Mar  8 06:13 php5-pgsql-5.2.13p0.tgz
-rw-r--r--  3 root  wheel      9122 Mar  8 06:13 php5-pspell-5.2.13p0.tgz
-rw-r--r--  3 root  wheel      5042 Mar  8 06:13 php5-shmop-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     12078 Mar  8 06:14 php5-snmp-5.2.13p0.tgz
-rw-r--r--  3 root  wheel    137871 Mar  8 06:13 php5-soap-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     29498 Mar  8 06:14 php5-sqlite-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     19351 Mar  8 06:14 php5-sybase_ct-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     18157 Mar  8 06:14 php5-tidy-5.2.13p0.tgz
-rw-r--r--  3 root  wheel     40021 Mar  8 06:14 php5-xmlrpc-5.2.13p1.tgz
-rw-r--r--  3 root  wheel     14084 Mar  8 06:14 php5-xsl-5.2.13p0.tgz
-rw-r--r--  3 root  wheel    307932 Mar  8 01:50 png-1.2.44.tgz
-rw-r--r--  3 root  wheel   1485742 Mar  8 04:47 postgresql-client-8.4.4.tgz
-rw-r--r--  3 root  wheel    407940 Mar  8 04:47 postgresql-contrib-8.4.4.tgz
-rw-r--r--  4 root  wheel   2236540 Mar  8 04:47 postgresql-docs-8.4.4.tgz
-rw-r--r--  3 root  wheel   4432311 Mar  8 04:47 postgresql-server-8.4.4.tgz
-rw-r--r--  3 root  wheel    383385 Mar  8 01:08 py-libxml-2.7.6.tgz
-rw-r--r--  3 root  wheel     60039 Mar  8 05:52 py-libxslt-1.1.26.tgz
-rw-r--r--  3 root  wheel   6508905 Mar  8 00:59 python-2.5.4p5.tgz
-rw-r--r--  3 root  wheel     33695 Mar  8 00:59 python-bsddb-2.5.4p5.tgz
-rw-r--r--  3 root  wheel      7680 Mar  8 00:59 python-gdbm-2.5.4p5.tgz
-rw-r--r--  3 root  wheel    460348 Mar  8 00:59 python-idle-2.5.4p5.tgz
-rw-r--r--  3 root  wheel   3279803 Mar  8 00:59 python-tests-2.5.4p5.tgz
-rw-r--r--  3 root  wheel    272992 Mar  8 00:59 python-tkinter-2.5.4p5.tgz
-rw-r--r--  3 root  wheel    417319 Mar  8 00:59 python-tools-2.5.4p5.tgz
-rw-r--r--  3 root  wheel    650400 Mar  8 04:22 shared-mime-info-0.71.tgz
-rw-r--r--  3 root  wheel    399022 Mar  8 05:12 sqlite-2.8.17p1.tgz
-rw-r--r--  3 root  wheel    592804 Mar  8 00:45 sqlite3-3.6.23p0.tgz
-rw-r--r--  3 root  wheel     20354 Mar  8 00:45 sqlite3-tcl-3.6.23.tgz
-rw-r--r--  3 root  wheel    810092 Mar  8 01:54 t1lib-5.1.0p2.tgz
-rw-r--r--  3 root  wheel   1803123 Mar  8 00:48 tcl-8.4.19.tgz
-rw-r--r--  3 root  wheel   2336716 Mar  8 00:42 tcl-8.5.8p0.tgz
-rw-r--r--  3 root  wheel    473683 Mar  8 05:53 tidy-051026.tgz
-rw-r--r--  3 root  wheel    888489 Mar  8 03:04 tiff-3.9.4.tgz
-rw-r--r--  3 root  wheel   1746862 Mar  8 00:51 tk-8.4.19p0.tgz
-rw-r--r--  3 root  wheel    116984 Mar  8 04:32 uuid-1.6.0p1.tgz
-rw-r--r--  3 root  wheel     37361 Mar  8 02:59 xdg-utils-1.0.2p8.tgz
#
因为这并非是port系统默认的packages,所以如果你今后重新安装系统时可能还需要它们请自行备份。
本例中为了简单起见,我们安装安装了所有的模块,自然,一般情况下你不需要这样,请根据自己的需要自行安装相应的模块。上面说了,你也可以在编译过程中指定特定的编译参数来构建自己的所需的模块。
代码:
# pwd
/usr/ports/packages/i386/all
# pkg_add php5*
php5-bz2-5.2.13p0: ok
php5-curl-5.2.13p0: ok
php5-dba-5.2.13p0: ok
php5-dbase-5.2.13p0: ok
php5-fastcgi-5.2.13p0: ok
php5-gd-5.2.13p0: ok
php5-gmp-5.2.13p0: ok
php5-imap-5.2.13p0: ok
php5-ldap-5.2.13p0: ok
php5-mbstring-5.2.13p0: ok
php5-mcrypt-5.2.13p0: ok
php5-mhash-5.2.13p0: ok
php5-mssql-5.2.13p0: ok
php5-mysql-5.2.13p0: ok
php5-mysqli-5.2.13p0: ok
php5-ncurses-5.2.13p0: ok
php5-odbc-5.2.13p0: ok
php5-pdo_dblib-5.2.13p0: ok
php5-pdo_mysql-5.2.13p0: ok
php5-pdo_pgsql-5.2.13p0: ok
php5-pdo_sqlite-5.2.13p0: ok
php5-pgsql-5.2.13p0: ok
php5-pspell-5.2.13p0: ok
php5-shmop-5.2.13p0: ok
php5-snmp-5.2.13p0: ok
php5-soap-5.2.13p0: ok
php5-sqlite-5.2.13p0: ok
php5-sybase_ct-5.2.13p0: ok
php5-tidy-5.2.13p0: ok
php5-xmlrpc-5.2.13p1: ok
php5-xsl-5.2.13p0: ok
--- +php5-bz2-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/bz2.ini to
/var/www/conf/php5/bz2.ini.

ln -fs /var/www/conf/php5.sample/bz2.ini \
        /var/www/conf/php5/bz2.ini
--- +php5-curl-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/curl.ini to
/var/www/conf/php5/curl.ini.

ln -fs /var/www/conf/php5.sample/curl.ini \
        /var/www/conf/php5/curl.ini
--- +php5-dba-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/dba.ini to
/var/www/conf/php5/dba.ini.

ln -fs /var/www/conf/php5.sample/dba.ini \
        /var/www/conf/php5/dba.ini
--- +php5-dbase-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/dbase.ini to
/var/www/conf/php5/dbase.ini.

ln -fs /var/www/conf/php5.sample/dbase.ini \
        /var/www/conf/php5/dbase.ini
--- +php5-gd-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/gd.ini to
/var/www/conf/php5/gd.ini.

ln -fs /var/www/conf/php5.sample/gd.ini \
        /var/www/conf/php5/gd.ini
--- +php5-gmp-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/gmp.ini to
/var/www/conf/php5/gmp.ini.

ln -fs /var/www/conf/php5.sample/gmp.ini \
        /var/www/conf/php5/gmp.ini
--- +php5-imap-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/imap.ini to
/var/www/conf/php5/imap.ini.

ln -fs /var/www/conf/php5.sample/imap.ini \
        /var/www/conf/php5/imap.ini
--- +php5-ldap-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/ldap.ini to
/var/www/conf/php5/ldap.ini.

ln -fs /var/www/conf/php5.sample/ldap.ini \
        /var/www/conf/php5/ldap.ini
--- +php5-mbstring-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/mbstring.ini to
/var/www/conf/php5/mbstring.ini.

ln -fs /var/www/conf/php5.sample/mbstring.ini \
        /var/www/conf/php5/mbstring.ini
--- +php5-mcrypt-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/mcrypt.ini to
/var/www/conf/php5/mcrypt.ini.

ln -fs /var/www/conf/php5.sample/mcrypt.ini \
        /var/www/conf/php5/mcrypt.ini
--- +php5-mhash-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/mhash.ini to
/var/www/conf/php5/mhash.ini.

ln -fs /var/www/conf/php5.sample/mhash.ini \
        /var/www/conf/php5/mhash.ini
--- +php5-mssql-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/mssql.ini to
/var/www/conf/php5/mssql.ini.

ln -fs /var/www/conf/php5.sample/mssql.ini \
        /var/www/conf/php5/mssql.ini
--- +php5-mysql-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/mysql.ini to
/var/www/conf/php5/mysql.ini.

ln -fs /var/www/conf/php5.sample/mysql.ini \
        /var/www/conf/php5/mysql.ini
--- +php5-mysqli-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/mysqli.ini to
/var/www/conf/php5/mysqli.ini.

ln -fs /var/www/conf/php5.sample/mysqli.ini \
        /var/www/conf/php5/mysqli.ini
--- +php5-ncurses-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/ncurses.ini to
/var/www/conf/php5/ncurses.ini.

ln -fs /var/www/conf/php5.sample/ncurses.ini \
        /var/www/conf/php5/ncurses.ini
--- +php5-odbc-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/odbc.ini to
/var/www/conf/php5/odbc.ini.

ln -fs /var/www/conf/php5.sample/odbc.ini \
        /var/www/conf/php5/odbc.ini
--- +php5-pdo_dblib-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/pdo_dblib.ini to
/var/www/conf/php5/pdo_dblib.ini.

ln -fs /var/www/conf/php5.sample/pdo_dblib.ini \
        /var/www/conf/php5/pdo_dblib.ini
--- +php5-pdo_mysql-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/pdo_mysql.ini to
/var/www/conf/php5/pdo_mysql.ini.

ln -fs /var/www/conf/php5.sample/pdo_mysql.ini \
        /var/www/conf/php5/pdo_mysql.ini
--- +php5-pdo_pgsql-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/pdo_pgsql.ini to
/var/www/conf/php5/pdo_pgsql.ini.

ln -fs /var/www/conf/php5.sample/pdo_pgsql.ini \
        /var/www/conf/php5/pdo_pgsql.ini
--- +php5-pdo_sqlite-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/pdo_sqlite.ini to
/var/www/conf/php5/pdo_sqlite.ini.

ln -fs /var/www/conf/php5.sample/pdo_sqlite.ini \
        /var/www/conf/php5/pdo_sqlite.ini
--- +php5-pgsql-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/pgsql.ini to
/var/www/conf/php5/pgsql.ini.

ln -fs /var/www/conf/php5.sample/pgsql.ini \
        /var/www/conf/php5/pgsql.ini
--- +php5-pspell-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/pspell.ini to
/var/www/conf/php5/pspell.ini.

ln -fs /var/www/conf/php5.sample/pspell.ini \
        /var/www/conf/php5/pspell.ini
--- +php5-shmop-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/shmop.ini to
/var/www/conf/php5/shmop.ini.

ln -fs /var/www/conf/php5.sample/shmop.ini \
        /var/www/conf/php5/shmop.ini
--- +php5-snmp-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/snmp.ini to
/var/www/conf/php5/snmp.ini.

ln -fs /var/www/conf/php5.sample/snmp.ini \
        /var/www/conf/php5/snmp.ini
--- +php5-soap-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/soap.ini to
/var/www/conf/php5/soap.ini.

ln -fs /var/www/conf/php5.sample/soap.ini \
        /var/www/conf/php5/soap.ini
--- +php5-sqlite-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/sqlite.ini to
/var/www/conf/php5/sqlite.ini.

ln -fs /var/www/conf/php5.sample/sqlite.ini \
        /var/www/conf/php5/sqlite.ini
--- +php5-sybase_ct-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/sybase_ct.ini to
/var/www/conf/php5/sybase_ct.ini.

ln -fs /var/www/conf/php5.sample/sybase_ct.ini \
        /var/www/conf/php5/sybase_ct.ini
--- +php5-tidy-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/tidy.ini to
/var/www/conf/php5/tidy.ini.

ln -fs /var/www/conf/php5.sample/tidy.ini \
        /var/www/conf/php5/tidy.ini
--- +php5-xmlrpc-5.2.13p1 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/xmlrpc.ini to
/var/www/conf/php5/xmlrpc.ini.

ln -fs /var/www/conf/php5.sample/xmlrpc.ini \
        /var/www/conf/php5/xmlrpc.ini
--- +php5-xsl-5.2.13p0 -------------------
You can enable this module by creating a symbolic
link from /var/www/conf/php5.sample/xsl.ini to
/var/www/conf/php5/xsl.ini.

ln -fs /var/www/conf/php5.sample/xsl.ini \
        /var/www/conf/php5/xsl.ini
#
然后根据系统提示运行ln-fs,此处略去。

接下来是调整apche2的配置文件/etc/apache2/httpd2.conf,让apache支持php索引

代码:
DirectoryIndex index.html
设置为
代码:
DirectoryIndex index.html index.php
让apache2支持对.php文件代码的分析

代码:
...........
里加上
代码:
AddType application/x-httpd-php .php
添加php的DSO模块支持。
代码:
LoadModule php5_module /usr/local/lib/php/libphp5.so

安装pear
代码:
# pkg_add pear pear-1.7.2:pear-utils-1.7.2: ok pear-1.7.2: ok
安装
代码:
# pkg_add p5-XML-Parser
编辑 /var/www/conf/php.ini
找到:
代码:
; Maximum size of POST data that PHP will accept. post_max_size = 8M
这会限制每个帖子的大小,放大一些吧,我是改为50M。
找到:
代码:
; Maximum allowed size for uploaded files. upload_max_filesize = 2M
这会限制上传文件大小,请自己根据需要修改
找到:
代码:
; Maximum number of files that can be uploaded via a single request max_file_uploads = 20
一次最多上传的文件数,请自行修改。
还有两个我是一般要修改的:
代码:
short_open_tag = On display_errors = On
这里请注意,配置文档里强烈建议在生产环境里关闭第二条选项,而以日志文档的方式代替,我打开这个只是因为每种论坛程序需要的php模块可能略有差别,有时候可能因为缺少模块安装过程无法继续或运行不正常,这无法在这里一一列举了,而且就我所尝试的程序也很有限,大家在实际应用中应该结合自己的情况并具体错误提示找出适合的php5插件,一旦你确认运行无误后请自行将第二个参数修改为Off。

最后说一下rewrite规则的设定,apache2的配置文件在 /etc/apache2/httpd2.conf, 请确保这里没有被注释掉:
代码:
LoadModule rewrite_module /usr/local/lib/apache2/mod_rewrite.so
此外,再将下列代码里面的红色部分设置为All
代码:

    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    #
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All
    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
好了,到此为止,基本上OpenBSD+Apache2+Mysql+PHP的环境就算搭建完毕了,剩下的内容请参阅原来我写的apache 1.3的帖子、或者根据您的实际情况自我调整,这里就不多说了。
阅读(1758) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~