4. 安装 apache + php + mysql
安装步骤按 http://vb2005xu.iteye.com/blog/1682189 来进行吧
下载的是 httpd-2.2.25,把它装在自己的目录中吧
./configure --prefix=/home/kenxu/dist/apache2 --disable-status --disable-userdir --disable-threads --disable-ipv6 --enable-modules='ssl so rewrite deflate headers expires'
使用 上文1 安装的编译环境会爆出 apr 和 apr-devel apr-utils没有安装,在软件中心搜索安装即可
deflate 这个扩展 会爆出:
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
这是因为 没有安装zlib包,安装zlib-devel
接着会爆出:
configure: error: ...No recognized SSL/TLS toolkit detected
这是因为 没有安装openssl包,安装openssl-devel
此时配置成功,make 时出错:
libtool: link: cannot find the library `/usr/lib/libexpat.la' or unhandled argument `/usr/lib/libexpat.la'
这是因为 没有安装expat库,安装expat-dev
make clean 之后再次运行 make
libtool: link: cannot find the library `/usr/lib/libuuid.la' or unhandled argument `/usr/lib/libuuid.la'
找了N久都没找到相应的信息,最后想起在centos中这个包好像是在libuuid is part of the util-linux-ng package since version 2.15.1,安装 util-linux-ng-dev ,再次 make 就通过了
make install 成功安装
mysql 就直接从软件中心里面安装了,安装之后配置下就行
安装万之后,配置文件在/etc/mysql/my.cnf,在里面新增参数:
skip-name-resolve
innodb_buffer_pool_size=768M
innodb_flush_log_at_trx_commit=2
然后运行 mysqld_safe & 即可
PHP是下载的 php-5.3.27 版本
类似apache编译方式,采取静态编译的方式来编译扩展,并禁用无需的模块:
./configure --prefix=/home/kenxu/dist/php --with-apxs2=/home/kenxu/dist/apache2/bin/apxs --with-config-file-path=/home/kenxu/dist/php/php-config --with-png-dir --with-jpeg-dir --with-gd --with-curl --with-zlib --enable-mbstring --with-mcrypt --with-freetype-dir=/usr --with-mysql=/usr/bin/mysql --with-mysqli --enable-pdo --with-pdo-mysql=/usr/bin/mysql --without-pdo-sqlite --with-openssl
爆出:
configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
安装 curl-dev 包后解决
接着会报 libpng-dev , libjpeg-dev,gd-dev,freetype-dev 未找到,全部装上
再次运行会爆出:
configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.
找到 libmcrypt 将 libmcrypt,libmcrypt-dev都装上
再次运行会爆出:
configure: error: Cannot find MySQL header files under /usr/bin/mysql
仔细检查发现,原来mysql安装的时候头文件在 /usr/include/mysql下所以此处指定/usr就行
./configure --prefix=/home/kenxu/dist/php --with-apxs2=/home/kenxu/dist/apache2/bin/apxs --with-config-file-path=/home/kenxu/dist/php/php-config --with-png-dir --with-jpeg-dir --with-gd --with-curl --with-zlib --enable-mbstring --with-mcrypt --with-freetype-dir=/usr --with-mysql=/usr --with-mysqli --enable-pdo --with-pdo-mysql=/usr --without-pdo-sqlite --with-openssl
此时配置成功,make爆出
致命错误:libxml/parser.h:没有那个文件或目录
安装 libxml2-dev 包之后解决,再次运行爆出 libidn没找到,安装libidn-dev继续编译,libssh2-dev也要安装
openldap-dev,cyrus-sasl-dev,gnutls-dev,libtasn1-dev,libgpg-error-dev也要安装
再次make通过了,make test 下试试,跑完10634个测试,安装即可