用configure配置lamp环境
一、编译MYSQL
#tar -zxvf mysql-......
#cd mysql-......
#groupadd mysql
#useradd -g mysql mysql
#./configure --prefix=/usr/local/lamp/mysql 安装路径
--with-client-ldflags=-all-static 静态化
--with-mysql-ldflags=-all-static
--enable-assembler 使用汇编模式
--with-unix-socket-path=/tmp/mysql.sock 使用unix socket
--with-extra-charsets=utf8,gbk,gb2312 支持字符集
--with-charset=utf8 默认字符集
#make;make instll
#cp support-files/my-medium.cnf /etc/my.cnf
#cd /usr/local/lamp/mysql
#bin/mysql_install_db 初始化数据库
#chown -R root .
#chgrp -R mysql .
#chown -R mysql var
#/usr/local/lamp/mysql/bin/mysqld_safe & 启动mysql
mysql>use mysql;
mysql>delete from user where user='';
mysql>grant all on *.* to steady@'%' identified by 'steady'
mysql>flush privileges;
二、编译APACHE
1、编译apache
#tar -zxvf httpd-......
#cd httpd-......
#groupadd apache
#useradd -g apache apache
#./configure --prefix=/usr/local/lamp/apache 指定安装路径
--enable-so 支持DSO
--enable-mods-shared=all 将所有模块转化为动态的
--enable-proxy 将代理模块作为静态的模块
**************rhel5编译apache出错***********
checking whether to enable mod_substitute... shared (all)
checking whether to enable mod_charset_lite... no
checking whether to enable mod_deflate... checking dependencies
checking for zlib location... not found
checking whether to enable mod_deflate...
configure: error: mod_deflate has been requested but can not be built due to rerequisite failures
checking whether to enable mod_deflate... checking dependencies
checking for zlib location... not found
checking whether to enable mod_deflate...
configure: error: mod_deflate has been requested but can not be built due to rerequisite failures
解决方法:rpm -ivh openssl-devel-.......
2、设置开机自动启动
#cd /usr/local/apache/bin
#cp apachectl /etc/rc.d/init.d/httpd
#chmod 700 /etc/rc.d/init.d/httpd
#vi /etc/rc.d/init.d/httpd
在-----------start configuration section--------------下面添加三行
#Comments to support chkconfig on RedHat Linux
#chkconfig:2345 90 90
#description:http server
注意:前面的#不能少,没有这三行,在使用chkconfig时会提示你:service http does not support chkconfig
#chkconfig --add httpd
#chkconfig --level 345 httpd on
这样,在运行级别345上httpd就可以自动启动了
对于这个提示:
http:Could not determine the server's fully qualitied domain name,using 127.0.0.1 for ServerName
只需要编辑httpd.conf,找到ServerName****这一行,去掉前面的注释即可。
三、在编译之前安装一些PHP需要的包
freetype libpng libjpeg gd libxml2 zlib 还有各自的链接库包如:freetype-devel libpng-devel........。
还有三个包系统没有带的rpm包:libiconv libmcrypt mhash,需要在网上下载源包:download.chinaunix.net 或其他地方。、
编译libiconv
#cd libiconv
#configure --prefix=/usr/local/libiconv
#make;make install
编译libmcrypt mhash
#./configure
#make;make install
四、编译PHP
#tar -zxvf php-....
#cd php-....
#./configure --prefix=/usr/local/lamp/php
--with-apxs2=/usr/local/lamp/apache/bin/apxs 指定apache的apxs工具位置
--with-mysql=/usr/local/lamp/mysql 指定mysql安装路径
--with-freetype-dir
--with-jpeg-dir
--with-png-dir
--with-zlib
--with-libxml-dir
--with-gd
--enable-xml
--disable-debug
--enable-gd-native-ttf
--with-iconv=/usr/local/libiconv libiconv装在那里就写那里路径
**************rhel5编译php出错***********
checking for flex... lex
checking for yywrap in -ll... no
checking lex output file root... ./configure: line 3246: lex: command not found
configure: error: cannot find output from lex; giving up
解决方法:rpm -ivh flex-.....
checking for yywrap in -ll... no
checking lex output file root... ./configure: line 3246: lex: command not found
configure: error: cannot find output from lex; giving up
解决方法:rpm -ivh flex-.....
**************rhel5编译php make时出错*****
/home/admin/LAMP/php-5.1.4/ext/iconv/iconv.c:1152: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o:/home/admin/LAMP/php-5.1.4/ext/iconv/iconv.c:1196: more
undefined references to `libiconv' follow
ext/iconv/.libs/iconv.o:/home/admin/LAMP/php-5.1.4/ext/iconv/iconv.c:1196: more
undefined references to `libiconv' follow
make: *** [sapi/cli/php] Error 1
解决方法:-----重新编译libiconv这个包
解决方法:-----重新编译libiconv这个包
#tar -zxvf libiconv-....
# cd libiconv-........
#./configure --prefix=/usr/local/libiconv
#make;make install
解决方法:
#wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
#tar -zxvf libiconv-1.13.1.tar.gz
#cd libiconv-1.13.1
# ./configure --prefix=/usr/local/libiconv
# make
# make install
再检查php
#./configure --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-curl --with-gd --enable-gd-native-ttf --with-apxs2=/usr/local/apache/bin/apxs --enable-sockets --with-iconv=/usr/local/libiconv
#make
#make install
#wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
#tar -zxvf libiconv-1.13.1.tar.gz
#cd libiconv-1.13.1
# ./configure --prefix=/usr/local/libiconv
# make
# make install
再检查php
#./configure --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-curl --with-gd --enable-gd-native-ttf --with-apxs2=/usr/local/apache/bin/apxs --enable-sockets --with-iconv=/usr/local/libiconv
#make
#make install
另一种解决方法为去除iconv模块也能正常编译php,如下:(没有实验过)
编辑 Makefile 大約 77 行左右的地方:
EXTRA_LIBS = ..... -lcrypt
在最後加上 -liconv,例如:
EXTRA_LIBS = ..... -lcrypt -liconv
再运行make就可以了。
编辑 Makefile 大約 77 行左右的地方:
EXTRA_LIBS = ..... -lcrypt
在最後加上 -liconv,例如:
EXTRA_LIBS = ..... -lcrypt -liconv
再运行make就可以了。
最后一种方法:
#make ZEND_EXTRA_LIBS='-liconv'
#make install
#make install
**************rhel5编译好php后,启动apache出错***********
httpd: Syntax error on line 110 of /usr/local/lamp/apache/conf/httpd.conf:
Cannot load /usr/local/lamp/apache/modules/libphp5.so into server: /usr/local/lamp/apache/modules/libphp5.so
: cannot restore segment prot after reloc: Permission denied
错误原因是selinux搞的鬼
解决方法:
#vi /etc/sysconfig/selinux
SELINUX=enforcing 注释掉:#SELINUX=enforcing
SELINUX=disable
五、安装Zend Optimization3.3.3