sol9_x86+apache+mysql+php+discuz

环境:VM Solaris9 for x86
软件:httpd-2.0.52
mysql-4.0.16
php-4.3.9
Discuz-2.2F
参考的文档有:
http://bbs.chinaunix.net/forum/viewtopic.php?t=343241&highlight=llzqq
http://bbs.chinaunix.net/forum/viewtopic.php?t=43778
http://bbs.chinaunix.net/forum/viewtopic.php?t=329698
http://bbs.chinaunix.net/forum/viewtopic.php?t=129215&highlight=sql_lex.cc
http://bbs.chinaunix.net/forum/viewtopic.php?t=265341
http://bbs.chinaunix.net/forum/viewtopic.php?t=193717
http://bbs.chinaunix.net/forum/6/040921/411198.html

所需安装的软件包括:
bison-1.875d
perl-5.8.5
ncurse-5.4
autoconf-2.59
automake-1.9
make-3.80
zlib-1.2.1
gcc-3.4.1(libgcc-3.4.1在这其中)
上述软件可以从http://www.sunfreeware.com/下载


一、修改路径
vi /etc/profile
在最后写入:
PATH=$PATH:/usr/ccs/bin:/usr/local/lib:/usr/local/bin:/usr/lib:/usr/local/httpd/bin:/usr/local/mysql/share/mysql:/usr/local/mysql/bin


CC=gcc
CFLAGS="-O6"
CXX=gcc
CXXFLAGS="-O6 -felide-constructors -fno-exceptions -fno-rtti"
保存退出
执行. /etc/profile
使修改立即生效 。

二、编译MYSQL
useradd mysql
groupadd mysql
#./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql --with-charset=gb2312 --with-extra-charsets=all

--with-Unix-socket-path=/usr/local/mysql/var/mysql.sock
如在编译过程中出现:
In file included from /usr/include/sys/reg.h:13,
from /usr/include/sys/regset.h:24,
from /usr/include/sys/ucontext.h:21,
from /usr/local/lib/gcc/i386-pc-solaris2.9/3.4.0/include/sys/signal.h:249,
from /usr/include/signal.h:27,
from mysql.cc:40:
/usr/include/ia32/sys/reg.h:300: error: `upad128_t" does not name a type
/usr/include/ia32/sys/reg.h:301: error: `upad128_t" does not name a type
/usr/include/ia32/sys/reg.h:331: error: `upad128_t" does not name a type
make[2]: *** [mysql.o] Error 1
make[2]: Leaving Directory `/export/home/z3j/mysql-4.0.18/clIEnt"
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/export/home/z3j/mysql-4.0.18"
make: *** [all] Error 2

请修改/usr/include/ia32/sys/reg.h
在第245行
写入
typedef union {
long _q;
uint32_t _l[4];
} upad128_t;


如果出现:
sql_lex.cc: In function `void lex_init()":
sql_lex.cc:85: `symbols" undeclared (first use this function)
sql_lex.cc:85: (Each undeclared identifier is reported only once
sql_lex.cc:85: for each function it appears in.)
sql_lex.cc:87: `sql_functions" undeclared (first use this function)
sql_lex.cc: In function `int find_keyWord(LEX *, unsigned int, bool)":
sql_lex.cc:171: implicit declaration of function `int get_hash_symbol(...)"
sql_lex.cc:171: initialization to `SYMBOL *" from `int" lacks a cast

解决办法:
cd sql
make gen_lex_hash
./gen_lex_hash > lex_hash.h (如果提示xx文件找不到 , 就把/usr/local/lib/的xx文件cp到/usr/lib下)
make

# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
# /usr/local/mysql/bin/mysql_install_db
# chmod -R 1777 /usr/local/mysql/var
# chown -R mysql /usr/local/mysql/
# chgrp -R mysql /usr/local/mysql/
启动MYSQL:
# /usr/local/mysql/share/mysql/mysql.server start
# /usr/local/mysql/bin/mysqladmin -u root password 123456
# cp /usr/local/lib/libncurses.so.5 /usr/local/mysql/lib/mysql
# /usr/local/mysql/bin/mysql -uroot -p123456



三、编译APACHE

#./configure --prefix=/usr/local/httpd --enable-track-vars --enable-cgi --with-config-file-path=/usr/local/httpd/conf

--with-charset=gb2312 --with-extra-charsets=all --enable-so;make;make install

修改配置文件:
vi /usr/local/httpd/conf/httpd.conf
将Group #-1改为Group nobody

找到#AddType application/x-tar .tgz 这行 , 在下面加一行 。前面不要加#号 。
AddType application/x-httpd-php .php

推荐阅读