今天计划安装:nginx +php +mysql
nginx版本:0.8.20
php版本:5.3.3 (已集成php-fpm)
mysql :Ubuntu自带安装
先安装mysql 命令如下:
sudo apt-get install mysql-server mysql-client
安装过程中要 求输入密码,输入就OK了。
然后安装php
tar -zxvf php-5.3.3.tar.gz /usr/local/php5install
cd /usr/local/php5inxtall
./configure --prefix=/usr/local/php --enable-fpm --enable-openssl --with-mysql --with-mysqli
###其它配置选项依据大家各自的情况而定,因为我是第一次安装,也不是很懂,就只选了这几个。
但随后如下问题出现了:
checking for libevent >= 1.4.11 install prefix... no
configure: error: libevent >= 1.4.11 could not be found
一看以为是信赖包libvent没安装,于是输入以下命令:
sudo apt-get install libevent-1.4-2 (tab补全的包)
提示我:libevent-1.4-2 已经是最新的版本了。 说明已经安装了,
于是卸载掉重装
sudo apt-get remove libevent-1.4-2
sudo apt-get install livevent-1.4-2
但仍然出错。先记录一下。慢慢解决,解决方法,以后写上。
搜索了一下,说是要自己下载源码,编译安装。只有试下了。
下载地址在Linux公社(LinuxIDC.com)FTP里
为了怕出错,我专门用1.4.11这个版本 libevent-1.4.11-stable.tar.gz
FTP地址:ftp://www.6688.cc/
用户名:www.linuxidc.net
密码:www.6688.cc
在2010年LinuxIDC.com\8月\Ubuntu 10.04下安装php出现libevent >= 1.4.11 could not be found\
-----------------------------------------------------------
然后
tar -zxvf libevent-1.4.11-stable.tar.gz /usr/local/
cd /usr/local/libevent-1.4.11-stable
./configure --prefix=/usr/local/lib
make
make install
然后配置php安装,./configure --prefix=/usr/local/php --enable-fpm --enable-openssl --with-mysql --with-mysqli
这次错误同上,仍然没找到。
想想,是不是没指定库路径?
于是建立一个软链接
sudo ln -s /usr/local/lib/lib/libevent-1.4.so.2 /usr/lib/libevent-1.4.so.2
再配置php,错误依然。
后来发现是需要安装libevent-dev 这个包,安装后该错误消失。
又提示我安装libxml2 libxml2-dev 这次,我两个包都装上了。
又提示我
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!
这个错误,再继续解决。
应该是配置参数错误,没指定mysql的安装路径。于是改为下面名子:
因为不知道mysqli安装在什么地方,我就whereis mysql 找了下,试下/usr/share/mysql这个路径看行不。
./configure --prefix=/usr/local/php5.3.3 --enable-fpm --with-mysql=/usr/share/mysql --with-mysqli
错误依旧啊
configure: error: Cannot find MySQL header files under /usr/share/mysql.
Note that the MySQL client library is not bundled anymore!
再找办法了
####接下来的工作####
卸载mysql-server mysql-client
重装mysql-server mysql-clinet
sudo apt-get remove mysql-server mysql-client
sudo apt-get remove mysql-server-5.1 mysql-client-5.1
sudo apt-get installl mysql-server-5.1 mysql-client-5.1
安装完后,mysql正常工作,但配置php,仍然出错。
是不是包又安装错了?
说我少了mysql头文件,于是寻找whereis mysql
找到几个目录
mysql: /usr/bin/mysql /etc/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
sudo find / -name mysql.h
但没找到这个文件。不知道是哪出了问题。
又一个测试失败,继续。。。
######又来找其它办法来了######
安装一个mysql 的lib文件,命令如下:
sudo apt-get install libmysqlclient16 libmysqlclient16-dev
然后再./configure --prefix=/usr/local/php5.3.3 --enable-fpm --with-mysql=/usr/share/mysql --with-mysqli --with-openssl
OK
这次终于通过。然后就是
make&&make install
记录一下,真是一波三折。