日期:2014-05-17 浏览次数:20922 次
http://database.51cto.com/art/201005/201368.htm
MySQL+PHP5+Apache安装手记(Linux版本)
http://database.51cto.com? 2010-05-21 17:38? 佚名? 互联网? 我要评论(1)
摘要:我们今天主要向大家描述的是在Linux操作系统之下对MySQL+PHP5+Apache安装手记的具体描述,以下就是文章的具体操作方案。
标签:Mysql+php5+apache
限时报名参加“甲骨文全球大会·2010·北京”及“JavaOne和甲骨文开发者大会2010”
以下的文章主要介绍的是在linux操作系统之下对Mysql+php5+apache安装手记的具体描述,我前两天在相关网站看见Mysql+php5+apache安装手记的资料,觉得挺好,于是就拿出来供大家分享。
下载官方推荐的稳定版本httpd-2.2.3.tar.gz,
安装apache2
1.#./configure –prefix=/usr/local/apache2 –enable-module=alias –enable-module=most \? 2.–enable-module=vhost_alias –enable-shared=vhost_alias –enable-module=so –enable-shared=max 3.# make;make install 下载目前最新稳定版本mysql-standard-5.0.27-linux-i686-glibc23.tar.gz
无需安装,解压后移至/usr/local/mysql.
# groupadd mysql #建立mysql组
# useradd mysql -g mysql #建立mysql用户并且加入到mysql组中
# cd /usr/local/mysql
然后设置权限
1.# chown -R root . #设定root能访问/usr/local/mysql? 2.# chown -R mysql data #设定mysql用户能访问/usr/local/mysql/data ,里面存的是mysql的数据库文件? 3.# chown -R mysql data/. #设定mysql用户能访问/usr/local/mysql/data下的所有文件? 4.# chown -R mysql data/mysql/. #设定mysql用户能访问/usr/local/mysql/data/mysql下的所有文件? 5.# chgrp -R mysql . #设定mysql组能够访问/usr/local/mysql 运行mysql:
1.# /usr/local/mysql/bin/mysqld_safe –user=mysql & 修改root密码,默认为空:
1./usr/local/mysql/bin/mysqladmin -u root password ‘newpassword’ MYSQL+php5+apache安装完成
下载最新稳定版本php-5.1.6.tar.gz,
1. 安装zlib (安装libpng和gd前需要先安装zlib),
1.# tar zxvf zlib-1.2.3.tar.gz? 2.# cd zlib-1.2.3? 3.# ./configure? 4.# make;make install 2. 安装libpng,
1.# tar zxvf libpng-1.2.12.tar.gz? 2.# cd libpng-1.2.12? 3.# ./configure? 4.# make;make install 3. 安装freetype,
1.# tar zxvf freetype-2.2.1.tar.gz? 2.# cd freetype-2.1.10? 3.# ./configure –prefix=/usr/local/freetype? 4.# make;make install 4. 安装jpeg,
1.# tar zxvf jpegsrc.v6b.tar.gz? 2.# cd jpeg-6b? 3.# mkdir /usr/local/jpeg? 4.# mkdir /usr/local/jpeg/bin? 5.# mkdir /usr/local/jpeg/lib? 6.# mkdir /usr/local/jpeg/include? 7.# mkdir /usr/local/jpeg/man? 8.# mkdir /usr/local/jpeg/man/man1? 9.# ./configure –prefix=/usr/local/jpeg –enable-shared –enable-static? 10.# make;make install
5. 安装gd,
1.# tar zxvf gd-2.0.33.tar.gz? 2.# cd gd-2.0.33? 3.# ./configure –prefix=/usr/local/gd –with-jpeg=/usr/local/jpeg –with-freetype=/usr/local/freetype –with-png –with-zlib Mysql+php5+apache编译过程中会看到如下信息
** Configuration summary for gd 2.0.33:
1.Support for PNG library: yes? 2.Support for JPEG library: yes? 3.Support for Freetype 2.x library: yes? 4.Support for Fontconfig library: no? 5.Support for Xpm library: no? 6.Support for pthreads: yes 可以看到png 、 jpeg 、 freetype都已经安装上了
1.# make? 2.# make install? 6. 正式安装php
1.# tar zxvf php-5.1.6.tar.gz? 2.# cd php-5.1.6? 3.# ./configure –prefix=/usr/local/php5 –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/local/mysql –with-gd –with-zlib –with-png –with-jpeg –with-freetype –enable-sockets –with-iconv –enable-mbstring –enable-track-vars –enable-force-cgi-redirect –with-config-file-path=/usr/local/php5/etc 7.整合php和apache
1.cp php.ini-dist /usr/local/php5/etc/php.ini? 2.vi /usr/local/php5/etc/php.ini 将extension=php_mysql.dll前面的#去掉
8. 安装ZendOptimizer,
1.# tar zxvf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz? 2.# cd ZendOptimizer-3.0.1-linux-glibc21-i386? 3.# ./install.sh 安装操作: [ok] -> [EXIT] -> [YES] -> [/httpd/zend] -> [/httpd/apache/conf] -> [yes] -> [OK] -> [OK] -> [NO]
遇到的一些错误解决:
1.php5在configure时提示:configure: error: mysql configure failed.,只用–with-mysql参数提示:Cannot find MySQL header files under yes,去掉–with-mysql参数可以安装,php5将无法连接mysql+php5+apache,页面提示为:Fatal error: Call to undefined function mysql_connect()。
查阅了一下,发现是mysql5对应的版本不对导致的,换个版本就可以了。
我用mysql-standard-5.0.27-linux-i686.tar.gz时会提示,换了mysql-standard-5.0.27-linux-i686-gl