Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10658242
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 11:27:03

准备工作:
httpd-2.2.2.tar.gz
下载:
php-5.1.4.tar.gz
下载:
mysql-standard-5.0.21-linux-i686-glibc23.tar.gz
下载:
http://dev.mysql.com/downloads/mysql/5.0.html
一、先安装mysql5
代码:
1以下使用root身份
添加用户组和用户,mysql服务需要以mysql组的用户来执行
shell> groupadd mysql
shell> useradd -g mysql mysql
2释放压缩文件到/usr/local下
把压缩包放到/usr/local下
shell> cd /usr/local
shell> tar zxvf mysql-standard-5.0.21-linux-i686-glibc23.tar.gz
然后得到 一个文件夹mysql-standard-5.0.21-linux-i686-glibc23
3给这个巨长文件名的文件夹作个快捷方式,这样以后不用打那么长字了,呵呵
shell> ln -s mysql-standard-5.0.21-linux-i686-glibc23 mysql
4创建授权表
shell> cd /usr/local/mysql
shell> scripts/mysql_install_db --user=mysql
5更改许可权限
shell> cd /usr/local/mysql
shell> chown -R root  .
shell> chown -R mysql data
shell> chgrp -R mysql .
6启动mysql并且测试
shell> bin/mysqld_safe --user=mysql &
如果没有报错就是启动成功了
shell> bin/mysql
如果出现
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 5.0.21-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
说明成功了
 
 

二、安装Apache2
代码:
因为PHP是安装在apache之上的,所以在安装PHP之前要现装APACHE,而MYSQL是什么时候安装都可以。
1解压缩
shell> tar zxvf httpd-2.2.2.tar.gz
shell> cd httpd-2.2.2
2配置安装
shell> ./configure --prefix=/usr/local/apache2 --enable-module=so --enable-module=rewrite --enable-shared=max
没有出现错误就 继续下一步
3编译安装
shell> make
没有出现错误就 继续下一步
shell> make install
没有出现错误就 继续下一步
4安装完成,测试
进入/usr/local/apache2(地2布指定的安装路径)
vim htdocs/index.html
随便写点东西
执行bin/apachectl start &
如果启动成功
打开浏览器浏览 

如果看到你刚才些的东西,那么你的APACHE2安装成功了
 
 

三、安装PHP5
代码:
1解压缩
shell> tar zxvf php-5.1.4.tar.gz
shell> cd php-5.1.4
2配置安装
shell> ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-force-cgi-redirect --with-freetype-dir=/usr --with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-gdbm --with-gettext --with-iconv --with-jpeg-dir=/usr --with-png --with-zlib --with-xml --enable-calendar
注意:以上参数可能根据情况不同而改变,如果报错,请自己修改,如果你不想开启某些功能,也可以删除一些参数,影响不会很大
3编译安装
shell> make
shell> make install
4设置PHP配置文件php.ini
在压缩包里有个php.ini文件,把他拷贝到/usr/local/lib/php.ini
这里路径可以改变,你可以在上面的“2配置安装”一步中加上参数:--with-config-file-path=/some/path  就可以了
然后打开文件,修改register_globals值为   register_globals = On
5编辑APACHE2配置文件
使得APACHE2能够启动PHP模块:
APACHE2的配置文件应该在/usr/local/apache2/conf/httpd.conf
打开他,在最下面加入LoadModule php5_module modules/libphp5.so
注意:如果上面已经有了  就不用加了
使得APACHE2能对以.php结尾的地址进行识别
加入AddType application/x-httpd-php .php
OK现在安装结束
6测试
vim /usr/local/apache2/htdocs/index.php
写入
phpinfo();
?>
启动APACHE2
浏览器浏览

如果出现PHP信息,就说明OK了
哈哈
 
阅读(1330) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~