linux下php+mysql开发环境搭建笔记


由于以前的一个软件需要小型化,决定用php重写,把linux下开发环境搭建过程记录下来。
操作系统环境:RedHat Linux Enterprise AS4,装有gcc等开发工具包。
一、安装mysql5
[url]www.mysql.com[/url]下载源码包mysql-5.0.41.tar.gz
tar -zxvf mysql-5.0.41.tar.gz  //解压
cd mysql-5.0.41 //进入到解压后的目录
./configure --prefix=/opt/mysql --with-charset=gb2312 --with-extra-charsets=gbk,gb2312 --enable-thread-safe-client //配置参数 意义可看configure文件,用vi打开,查找Configure或者./configure --help
make //编译
make install //安装
cd /opt/mysql //进入到安装目录
/opt/mysql/bin/mysql_install_db --user=mysql //安装库
chown -R root /opt/mysql/
chown -R mysql /opt/mysql/var
chgrp -R mysql /opt/mysql/
cp /opt/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld //加入到启动项
ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc3.d/S97mysqld //做连接
service mysqld stop
service mysql start //启动
/opt/mysql/bin/mysqladmin -u root password 123456 //设置密码
二、安装apache2
[url]www.apache.org[/url]下载源码包httpd-2.2.4.tar.gz
tar -zxvf httpd-2.2.4.tar.gz //解压
cd httpd-2.2.4 //进入到解压后目录
./configure --prefix=/opt/apache2 --enable-so --enable-module=most --enable-rewrite --enable-shared=max --with-mpm=worker //配置参数
make
make install
cp /opt/apache2/bin/apachectl /etc/rc.d/init.d/httpd
service httpd restart //重启服务
三、安装php5
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8 //进入到解压目录
./configure --prefix=/opt/libmcrypt
make
make install
然后从[url]www.php.net[/url]下载源码包php-5.2.2.tar.gz
tar -zxvf php-5.2.2.tar.gz //解压
cd php-5.2.2
./configure --prefix=/opt/php5 --with-apxs2=/opt/apache2/bin/apxs --enable-trace-avrs --with-mysql=/opt/mysql --enable-shared --enable-mbstring=all --enable-mbregex --enable-so --with-mcrypt=/opt/libmcrypt //配置参数
make
make install
从解压目录把配置文件php.ini-dist复制到php安装目录的lib下并重命名为php.ini
cp php.in-dist /opt/php5/lib/php.ini
四、安装phpMyAdmin
[url]www.sourceforge.net[/url]下载最新版的多国语言版源码包
tar -zxvf phpMyAdmin-2.10.2-rc1-all-languages.tar.gz
mv phpMyAdmin-2.10.2-rc1-all-languages phpMyAdmin //重命名,名字太长,呵呵
cd phpMyAdmin
cp libraries/config.default.php config.inc.php //复制默认配置文件
用vi打开config.inc.php配置文件
$cfg['Servers'][$i]['auth_type'] = 'cookie'; //认证模式设为cookie
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['passWord'] = '';
配制加密私钥
$cfg['blowfish_secret'] = 'wjlwjl';
默认的数据导出、和导入最大文件有2M的最大限制。如果要操作大于2M的数据库备份文件就需要预先将文件上传到phpmyadmin的某个目录。
1、首先在phpMyAdmin下建一个上传文件保存目录upload
mkdir upload
chmod -R 755 upload
2、配置config.inc.php中的下列参数
$cfg['UploadDir'] = 'upload';                    
$cfg['SaveDir'] = 'upload';
 
配置完成!
posted @ 2011-09-23 19:09  绿色冰点  Views(307)  Comments(0Edit  收藏  举报