Apache+Mysql+php安装配置手记

来源:互联网 发布:视频音频截取软件 编辑:程序博客网 时间:2024/04/28 21:49
Apache+Mysql+php安装配置手记

Mysql-standard-4.0.24 + Apache-2.0.53 + php-4.3.10 + phpMyadmin-2.6.1

安装Mysql-standard-4.0.24

     shell> groupadd mysql
     shell> useradd -g mysql mysql
     shell> cd /usr/local
     shell> tar zxvf /PATH/TO/MYSQL-VERSION-OS.tar.gz
     shell> mv FULL-PATH-TO-MYSQL-VERSION-OS mysql
     shell> cd mysql
     shell> scripts/mysql_install_db --user=mysql
     shell> chown -R root  .
     shell> chown -R mysql data
     shell> chgrp -R mysql .
     shell> bin/mysqld_safe --user=mysql

脚本COPY
     shell> cp support-files/mysql.server /etc/rc.d/init.d/mysqld

     shell> chkconfig --add mysqld

用ntsysv设置使mysql每次启动都能自动运行。

好了,至此mysql安装完毕,你可以这样起动你的mysql服务

/etc/rc.d/init.d/mysqld start

下面这步比较关键,

     shell> ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
     shell> ln -s /usr/local/mysql/include/mysql /usr/include/mysql

大家可以不做这步,大可以在编译其他软件的时候自定义myslq的库文件路径,但我还是喜欢把库文件链接到默认的位置,这样你在编译类似PHP,Vpopmail等软件时可以不用指定mysql的库文件地址。

安装Apache-2.0.53 + php-4.3.10(DSO动态编译)

编译安装apache

     shell> tar zvxf httpd-2.0.53.tar.gz
     shell> cd httpd-2.0.46
     shell> ./configure --prefix=/usr/local/httpd --enable-so --enable-mods-shared=most

     shell> make
     shell> make install

大家注意了--enable-so相当与1.3.27的--enable-module=so,而--enable-mods-shared=most又等同与以前的
--enable-shared=max 这些区别大家要注意了,否则编译错了不要找我

然后编译PHP

     shell> tar zvxf php4.3.2.tar.gz
     shell> ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/httpd/bin/apxs
     shell> make
     shell> make install

注意是apxs2!!

修改httpd.conf与1.3.27也有所不同,大家寻找Add Type application/x-tar .tgz 在下面添加

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

启动一下apache

/usr/local/apache2/bin/apachectl start

用那个info.php测试一下,OK!!


安装配置phpMyadmin-2.6.1

 
解压后得到一个phpMyAdmin的目录(你可以改名)

找到目录里的config.inc.php文件,打开
找到 $cfg['PmaAbsoluteUri']
修改你将上传到空间的phpMyAdmin的网址
如:$cfg['PmaAbsoluteUri'] = 'http://your.domain.com/phpmyadmin/';

还有下面的
$cfg['Servers'][$i]['host'] = 'localhost';(通常用默认,也有例外)

$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
在自己的机子里调试用config,如果在网上用cookie。

$cfg['Servers'][$i]['user'] = 'root'; // MySQL user(用户名,自己机里用root,在网上设你的ftp用户名)
$cfg['Servers'][$i]['password'] = ''; // MySQL password(自己机里不用设,在网上设你的ftp密码)

自己机里不用设

$cfg['Servers'][$i]['only_db'] = ''; // If set to a db-name, only(你只有一个数据就设置一下)

注:$cfg['blowfish_secret'] = '';
本机的话不需要设置,但是网络的话需要设置成cookie:
$cfg['blowfish_secret'] = 'cookie';

浏览http://your.domain.com/phpmyadmin/ 当然你设置不同就用那个网址。
如果设置了cookie(看上面)就会有登陆窗口。

全部OK啦~记得改一下mysql的root密码,初始是空的。

原创粉丝点击