Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1436176
  • 博文数量: 463
  • 博客积分: 10540
  • 博客等级: 上将
  • 技术积分: 5450
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-12 08:30
文章分类

全部博文(463)

文章存档

2014年(2)

2012年(14)

2011年(42)

2010年(18)

2009年(78)

2008年(35)

2007年(182)

2006年(92)

我的朋友

分类: LINUX

2007-07-20 11:07:40

内容:
先安装MYSQL5.0 服务器(安装好后,默认用户名为root,默认密码为mysql)
下载时下载编译好的那种
解压MySQL,把所有文件复制到/usr/local/mysql
[root@Bleach usr]# groupadd mysql
[root@Bleach usr]# useradd -g mysql mysql
[root@Bleach mysql]# cd mysql
[root@Bleach mysql]# scripts/mysql_install_db --user=mysql
[root@Bleach mysql]# chown -R root .
[root@Bleach mysql]# chown -R mysql data
[root@Bleach mysql]# chgrp -R mysql .
[root@Bleach mysql]# ./bin/mysqld_safe --user=mysql &
[root@Bleach mysql]# ./bin/mysqladmin -u root password mysql
[root@Bleach mysql]# cp ./support-files/mysql.server /etc/init.d/mysql
[root@Bleach mysql]# cd /etc/rc3.d/
[root@Bleach rc3.d]# ln -s /etc/init.d/mysql S85mysql
[root@Bleach rc3.d]# ln -s /etc/init.d/mysql K85mysql
安装GD库基本包gd-devel
#rpm -ivh gd-devel-1.8.4-11.i386.rpm
安装XPM支持
#rpm -ivh xpm-3.4k-2.i386.rpm
安装libxml2 (记得PHP5.1.1只支持libxml2-2.6.11以上版本)
#tar zxvf libxml2-2.6.11.tar.gz
#cd libxml2-2.6.11
#./configure
#make
#make install
开始装GD库支持
-------------------------------------------------------
先安装GD基础rpm包
#rpm –ivh gd-devel.rpm
ZLIB
#./configure
#make
#make install
JPEGSRC
#./configure --enable-shared
#make
#make install-lib
#make install
LIBPNG
#cp scripts/makefile.std Makefile
#make
#make install
最后是GD2.*
#./configure --with-png=/usr/local --with-jpeg=/usr/local --with-freetype=/usr
#make
#make install
----------------------------------------------
上面一切都很顺利的话,GD就算成功的安装上了. 如果有问题,应该是缺少支持包,总之是少什么就下载什
么来安装上.
跟着下来,开始安装APAHCHE2和PHP5
#./configure --prefix=/usr/local/apache2 --enable-module=so
#make
#make install
PHP5
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-gd=/usr/local --enable-trace-vars --with-zlib-dir=/usr/local -with-mysql=/usr/local/mysql --enable-mbstring=all
#make
#make install
复制PHP.INI文件到正确位置
在PHP目录下运行
#cp php.ini-dist /usr/local/php/lib/php.ini
编辑apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
要改的有如下几处:
一般都在
#AddType application/x-tar .tgz
下加一行
AddType application/x-httpd-php .php
查找
index.html
在后面加 index.htm index.php 让它把index.php做为默认页
再找
#ServerName
把#去掉,后面的IP改成你的IP.
找到
"/usr/local/apache2/htdocs"
把两个"/usr/local/apache2/htdocs"改为你存放网页文件的路径
保存httpd.conf文件.
启动它
# /usr/local/apache2/bin/apachectl start
如果没有出错,写一个测试页放到你网页目录下, 我的就是上面所说的 /www
phpinfo();
?>
保存.试试在测试器里打IP进去就可以看到PHPINFO页了
把Apache2加入系统服务
#cd /etc/init.d
#cp /usr/local/apache/bin/apachectl ./httpd
用文本编辑/etc/init.d/httpd
在头部加入
#chkconfig: 345 79 15
#description: Activates/Deactivates Apache Web Server
# processname: httpd
#chkconfig --add httpd
安装ZendOptimizer-2.5.3加速PHP
#./install.sh
------------------------
一直想写篇关于Linux下 PHP环境的详细安装配置文章, 没什么时间
趁现要配几台服务器, 借此机会把自己安装配置的步骤写出来, 供初学者参考!
有什么错误的地方请大家指证批评,谢谢! - by Mayer
首先我在 /root 目录下建了一个 soft 文件夹来保存我要安装的源码包
mkdir /root/soft
cd /root/soft
先找到 apache php mysql proftpd 源码包下载的URL地址
请浏览




等官方网站
使用wget 直接下载
wget ...
wget ...
第一步:安装apache
注:当前目录为/root/soft ,
目录下有
httpd-2.0.55.tar.gz, php-5.0.5.tar.gz
等二进制源码包
#号代表为root 根权限,#后是输入的一条命令
执行下列命令
解压源码包
# tar -zxf httpd-2.0.55.tar.gz
进入安装目录
# cd httpd-2.0.55
配置apache安装信息
# ./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite
执行make安装
# make; make install
安装完后
# vi /usr/local/apache/conf/httpd.conf
找到 prefork.c 下的
MaxClients 150
改为
ServerLimit  2000
MaxClients 1000
apache默认工作在prefork.c模式下,并发进程为150,超过后就无法访问,150是远远不够的,所以这里按自己网站的需求改, 如1000
由于apache默认最大并发进程是 256 所以要先设置 ServerLimit 2000 将服务器可设的最大并发数设为2000, 然后再设置最大并发数 MaxClients 1000
找到 #ServerName 在其下设置 ServerName 如下
ServerName
基中 为你网站名,也可用IP代替
找到 DocumentRoot "/usr/local/apache/htdocs"
设置你的 WEB 服务器的根目录 如
DocumentRoot "/myweb"
找到 DirectoryIndex index.html index.html.var 改为
DirectoryIndex index.html index.php index.htm
找到 ForceLanguagePriority Prefer Fallback 在其下加上
AddDefaultCharset gb2312
改完后保存(vi 的用法请查 Linux vi 命令)
用下面命令启动WEB服务器
# /usr/local/apache/bin/apachectl start
查看自己的站点是否正常 也可用IP
用 # /usr/local/apache/bin/apachectl stop 可停止服务
安装MYSQL
# tar -zxf mysql-standard-5.0.15-linux-i686.tar.gz
# cp -r mysql-standard-5.0.15-linux-i686 /usr/local/mysql
# vi /usr/local/mysql/support-files/my-medium.cnf
在后面加上
max_connections = 1000
log-slow-queries
long_query_time = 5
注 max_connections 为允许的最大连接数
log-slow-queries 打开低速查询日志
long_query_time 低速查询的秒数(运行一句sql达到此时间记录在日志里)
然后COPY 它为 /etc/my.cnf 文件
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
添加mysql用户及用户组
# groupadd mysql
# useradd -g mysql mysql
修改mysql目录权限
# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql/data
生成mysql系统数据库
# /usr/local/mysql/scripts/mysql_install_db --user=mysql&
启动mysql服务
# /usr/local/mysql/bin/mysqld_safe --user=mysql&
如出现 Starting mysqld daemon with databases from /usr/local/mysql/data
代表正常启动mysql服务了, 按Ctrl + C 跳出
修改 mysql 的 root 密码
# /usr/local/mysql/bin/mysqladmin -u root -p password 123456
回车出现 Enter password: 最开始密码默认为空 继续回车即可
123456 即为你的新密码
安装GD库(让PHP支持GIF,PNG,JPEG)
首先下载 jpeg6,libpng,freetype 并安装模块
wget ...
wget ...
wget ...
wget ...
安装 jpeg6
建立目录
# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/bin
# mkdir /usr/local/jpeg6/lib
# mkdir /usr/local/jpeg6/include
# mkdir /usr/local/jpeg6/man
# mkdir /usr/local/jpeg6/man/man1
# cd /root/soft
# tar -zxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make; make install
安装libpng
# cd /root/soft
# tar -zxf libpng-1.2.8.tar.gz
# cd libpng-1.2.8
# cp scripts/makefile.std makefile
# make; make install
安装 freetype
# cd /root/soft
# tar -zxf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# ./configure --prefix=/usr/local/freetype
# make;make install
安装最新的GD库
# cd /root/soft
# tar -zxf gd-2.0.33.tar.gz
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png --with-zlib --with-freetype=/usr/local/freetype/
# make; make install
安装最新的Curl库
# cd /root/soft
# wget http://curl.haxx.se/download/curl-7...
# tar -zxf curl-7.15.0.tar.gz
# ./configure --prefix=/usr/local/curl
# make; make install
安装PHP
由于php5需libxml2的支持, 所以先下载并安装libxml2
# cd /root/soft
# wget ...
# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# ./configure --prefix=/usr/local/libxml2
# make; make install
安装 libxslt
# cd /root/soft
# wget ...
# tar -zxf libxslt-1.1.15.tar.gz
# cd libxslt-1.1.15
# ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2
# make; make install
# tar -zxf php-5.0.5.tar.gz
# cd php-5.05
# ./configure --prefix=/usr/local/php
--with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/
--with-curl=/usr/local/curl --enable-ftp
--with-libxml-dir=/usr/local/libxml2 --with-expat-dir=/usr/lib
--enable-soap --with-xsl=/usr/local/libxslt --enable-xslt
--with-gd=/usr/local/gd2/ --with-jpeg-dir=/usr/local/jpeg6/
--with-zlib-dir=/usr/lib --with-png
--with-freetype-dir=/usr/local/freetype
# make
# make install
其中./configure 后的
--prefix=/usr/local/php
--with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql/
--with-libxml-dir=/usr/local/libxml2
是必要的选项
--with-gd=/usr/local/gd2/
--with-jpeg-dir=/usr/local/jpeg6/
--with-png
--with-zlib-dir=/usr/lib
--with-freetype-dir=/usr/local/freetype
这是让PHP支持GD库的配置选项
--with-curl=/usr/local/curl 支持CURL库
--enable-ftp 打开FTP库函数支持
--enable-soap --with-xsl=/usr/local/libxslt --enable-xslt
让PHP支持SOAP, 上面这些一般用得少, 可以去掉
配置 httpd.conf 让apache支持PHP
# vi /usr/local/apache/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
重启apache
# /usr/local/apache/bin/apachectl restart
在你Web目录里建一内容为  PHP文件, 输入URL地址查看PHP配置是否正确
安装 phpmyadmin
下载
# cd /root/soft
# wget ...
# tar -zxf phpMyAdmin-2.6.4-pl3.tar.gz
# vi phpMyAdmin-2.6.4-pl3/config.inc.php
找到 $cfg['Servers'][$i]['auth_type'] = 'config'; 将config 改为 http
保存后
mv phpMyAdmin-2.6.4-pl3 /你的phpmyadmin目录
关于mysql4.1-4移植4.0旧数据库中文乱码问题的解决方法
进入phpmyadmin管理
建立你数据库名并选上 gb2312_bin 的编码
然后导入你先前备份好的SQL文件, 导入时选择 文件的字符集:gb2312
完成后就OK了
注: PHP连接mysql4.1和5.0 数据库后需指定字符集 需执行如 mysql_query("SET NAMES 'gb2312' ");
否则会产生中文乱码问题!
阅读(871) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~