|
1.搭建php+mysql+apache平台
1.1 到www.mysql.com下载mysql-5.0.45-linux-i686-glibc23.tar.gz,
无需安装,解压后移至/usr/local/mysql
# groupadd mysql #建立mysql组
# useradd mysql -g mysql #建立mysql用户并且加入到mysql组中
然后设置权限
# chown -R root . #设定root能访问/usr/local/mysql
# chown -R mysql data #设定mysql用户能访问/usr/local/mysql/data ,里面存的是mysql的数据库文件
# chown -R mysql data/. #设定mysql用户能访问/usr/local/mysql/data下的所有文件
# chown -R mysql data/mysql/. #设定mysql用户能访问/usr/local/mysql/data/mysql下的所有文件
# chgrp -R mysql . #设定mysql组能够访问/usr/local/mysql
# /usr/local/mysql/bin/mysql_install_db //初始化授权
# chown –R root:root /usr/local/mysql //文件属性改为root用户
# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf //复制配置文件
----------------------------------启动MySQL服务----------------------------------
# /usr/local/mysql/bin/mysqld_safe --user=root & //启动MySQL
----------------------------------修改MySQL密码----------------------------------
# /usr/local/mysql/bin/mysqladmin -uroot password mysqlsecret //修改密码
----------------------------------关闭MySQL服务----------------------------------
# /usr/local/mysql/bin/mysqladmin -uroot -pmysqlsecret shutdown //关闭MySQL
1.2新建wiki数据库
mysql -u root -p
mysql>create database wikidb;
mysql>show databases;;
2.apache的安装
2.1下载httpd包
# ./configure --prefix=/usr/local/apache \
--enable-module=most \
--enable-shared=max
# make
# make install
----------------------------------启动Apache服务----------------------------------
# /usr/local/apache/bin/apachectl start
----------------------------------关闭Apache服务----------------------------------
# /usr/local/apache/bin/apachectl stop
----------------------------------重启Apache服务----------------------------------
# /usr/local/apache/bin/apachectl restart
3.安装php
# tar zvxf php-5.1.6.tar.gz
# cd php-5.1.6
# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs
注:若装得mysql rpm包 则 --with-mysql
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
4.配置Apache服务的httpd.conf文件
*在LoadModule处添加 LoadModule php5_module module/libphp5.so
*在DirectoryIndex处添加 index.php
*在AddType application处添加
AddType application/x-httpd-php .php .phtml
AddType applicatoin/x-httpd-php-source .phps
5.下载mediawiki包解压,
----------------------------------------------------------------------
mysql启动出错,提示:
Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/xmcncn.pid
mysqld ended
参考网上解决方法:
touch /tmp/mysql.sock
killall -9 mysqld
/usr/local/mysql/bin/mysqld_safe -user=mysql &
成功启动
|
|