最近的项目是将一套Windows下的apache+php+mysql全部转到Linux下,想简单了,以为只要代码搞定就ok了,遇到了些问题,不过还是客服了,只要想做没什么是做不到的!
大概的分析了一下Windows系统,有Apache、php、MySQL,这些转Linux都是开源的,手到擒来的是,好吧,开始动手,装个Linux,我们用的是Ubuntu 8.10 Server,装上,系统ok了,开始按步就班的安装Apache、php、MySQL,很easy啊~~~~导入代码,数据库,问题来了:
1、Session问题:总是提示在session_start()之前写了数据,这是啥问题呢?最大可能是字符集的问题,Windows是UTF-8,linux是GBK,狂找资料ing,nnd,问题好简单,只要修改php.ini就可以,有人说是要改2个地方,但是我只改了output_buffering = On,另外一个地方是默认的值,忘记是什么了,好像是session.auto_start = 1,暂时记上它吧;
2、一波未平,一波又起:验证码(Captcha.php)的问题,天啊,灾难,你知道,这个验证码要装GD包、freetype包,开始装吧~~~~~还好,不断奋战的装了n多个包,之后终于ok啦
3、忘记密码,竟然要求ssl支持,我倒!又从openssl开始--apache--php又编译了一遍,加上ssl后编译时间长了很多啊!
今天终于看到完整版的了,庆祝一下!
过程记录一下:
vi /etc/resolv.conf
nameserver 202.106.0.20
mv /etc/apt/sources.list /etc/apt/sources.list.default
vi /etc/apt/sources.list
deb intrepid main restricted universe multiverse
deb intrepid-security main restricted universe multiverse
deb intrepid-updates main restricted universe multiverse
deb intrepid-proposed main restricted universe multiverse
deb intrepid-backports main restricted universe multiverse
deb-src intrepid main restricted universe multiverse
deb-src intrepid-security main restricted universe multiverse
deb-src intrepid-updates main restricted universe multiverse
deb-src intrepid-proposed main restricted universe multiverse
deb-src intrepid-backports main restricted universe multiverse
apt-get update
apt-get install build-essential unzip vim-full libxml2 libxml2-dev libpng12-dev libssl-dev
Do you want to continue [Y/n]?y
vi /etc/vim/vimrc
syntax on
vi /etc/locale.alias
zh_Tw.big5 big5
zh_TW.UTF-8 UTF-8
en_US.UTF-8 UTF-8
en_AU.UTF-8 UTF-8
en_BW.UTF-8 UTF-8
en_CA.UTF-8 UTF-8
en_DK.UTF-8 UTF-8
en_GB.UTF-8 UTF-8
en_HK.UTF-8 UTF-8
en_IE.UTF-8 UTF-8
en_IN UTF-8
en_NZ.UTF-8 UTF-8
en_PH.UTF-8 UTF-8
en_SG.UTF-8 UTF-8
en_ZA.UTF-8 UTF-8
en_ZW.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_HK.UTF-8 UTF-8
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.GB18030:zh_CN:zh"
SYSFONT="lat0-sun16"
SYSFONTACM="8859-15"
dpkg-reconfigure locales
locale-gen zh_CN.GBK
vi /etc/profile
export LC_ALL=zh_CN.GBK
export LANG=zh_CN.GBK
source /etc/profile
vi /etc/environment
LC_ALL="zh_CN"
LC_CTYPE="GB2312"
LANG="zh_CN.GB2312"
source /etc/environment
tzselect
选择5--9--1--1
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate cn.pool.ntp.org
mysql
cd /backup/software
tar zxvf mysql-5.0.45-linux-i686-icc-glibc23.tar.gz
mv mysql-5.1.34-linux-i686-glibc23 /opt/
cd /opt
ln -s mysql-5.0.45-linux-i686-icc-glibc23 mysql
cd mysql/support-files
cp my-medium.cnf /etc/my.cnf
cp mysql.server /etc/init.d/
vi mysql.server
basedir=/opt/mysql
datadir=/opt/mysql/data
cd /opt/mysql
./scripts/mysql_install_db
export LANG=C
export LC_ALL=C
update-rc.d mysql.server defaults
groupadd mysql
useradd -g mysql mysql
vi /etc/my.cnf
mysqld部分加入
log=mylog.log
expire_logs_days = 5
chown -R root .
chown -R mysql data
chgrp -R mysql .
/etc/init.d/mysql.server start
cd /usr/bin/
ln -s /opt/mysql/bin/* .
登录mysql,删除test库:drop database test;
zlib
cd /backup/software
wget
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make && make install
libpng
cd /backup/software
wget
tar jxvf libpng-1.2.36.tar.bz2
cd libpng-1.2.36
./configure
make && make install
freetype
cd /backup/software
wget
tar jxvf freetype-2.3.9.tar.bz2
cd freetype-2.3.9
./configure --prefix=/opt/freetype
make && make install
jpeg
wget
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
mkdir /usr/local/man/man1/ -p
./configure --enable-shared
make && make test && make install
gd
wget
tar jxvf gd-2.0.35.tar.bz2
cd gd-2.0.35
./configure --with-png --with-freetype=/opt/freetype --with-jpeg --prefix=/opt/GD
make && make install
freetds
tar zxvf freetds-0.82.tar.gz
cd freetds-0.82
./configure --prefix=/opt/freeTDS
make && make install
openssl
wget
tar zxvf openssl-0.9.8k.tar.gz
cd openssl-0.9.8k
./config --prefix=/opt/openssl
make && make test && make install
apache
cd /backup/software
tar jxvf httpd-2.2.11.tar.bz2
cd httpd-2.2.11
./configure --prefix=/opt/apache2 --enable-module=most --enable-shared=max --enable-rewrite --enable-ssl --with-openssl=/opt/openssl
make && make install
cp /opt/apache2/bin/apachectl /etc/init.d/
update-rc.d apachectl defaults
php
tar zxvf php-5.2.9.tar.gz
cd php-5.2.9
./configure --prefix=/opt/php --with-apxs2=/opt/apache2/bin/apxs --with-mysql=/opt/mysql --with-gd=/opt/GD --with-zlib-dir --with-config-file-path=/opt/php --with-iconv --enable-mbstring=all --enable-mbregex --with-iconv --with-freetype-dir=/opt/freetype --with-jpeg-dir --with-png-dir --with-mssql=/opt/freeTDS --with-openssl=/opt/openssl
make && make install
cp php.ini-dist /opt/php/php.ini
vi /opt/apache2/conf/httpd.conf
AddType application/x-httpd-php .php3 .phtml .php .inc
AddType application/x-httpd-php-source .phps
Zend
tar zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
cd ZendOptimizer-3.3.3-linux-glibc23-i386
./install.sh
OK----EXIT----Yes----输入路径为/opt/Zend,ok----输入/opt/php,ok----Yes----/opt/apache2/bin/apachectl,ok----ok----ok----Yes----ok
阅读(729) | 评论(0) | 转发(0) |