编译安装php、apache常见参数及错误
***********************************常用 apache 编译参数说明**********************
prefix 指定安装目录
enable-rewrite 支持 URL 重写
enable-deflate 支持网页压缩
enable-speling 纠正常见的URL拼写错误
enable-ssl SSL/TLS support (mod_ssl)
with-module 加载模块
–enable-so 指明编译动态加载模块(DSO)支持到httpd二进制文件,此模块使得Apache的各功能模块可以与核心分开编译、运行时动态加载
错误解决:
错误一:
httpd: Could not reliably determine the server’s fully qualified domain name, using ::1 for ServerName
解决:打开httpd.conf 找到#ServerName www.example.com:80 把#去掉,再重启apache
httpd: Could not reliably determine the server’s fully qualified domain name, using 61.191.206.4 for ServerName
错误二:不能识php文件
解决: 打开httpd.conf文件,把
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps 两行加进去
大约在这两行下面
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
**************************************常用mysql编译参数说明**************************
enable-assembler 使用一些字符函数来汇编版本
with-extra-charsets=complex 使用的字符集为默认(无,复杂的,所有,或从上述设置选定的名单)
enable-thread-safe-client 让客户端支持线程
with-big-tables 大表支持
with-readline Use system readline instead of bundled copy
with-ssl Include SSL support
with-embedded-server 编译成embedded MySQL library (libmysqld.a)
enable-local-infile 让mysql支持从本地文件 导入数据库
with-plugins=innobase 存储引擎
with-charset=utf8 设置默认字符集
with-collation=utf8_general_ci 设置字符集校验规则
*******************************************常用PHP编译参数说明********************************
with-config-file-path 指定php.ini位置
with-apxs2 整合 apache,apxs功能是使用mod_so中的LoadModule指令,加载指定模块到 apache,要求 apache 要打开SO模块
with-mysql mysql安装目录,对mysql的支持
with-mysqli mysqli文件目录,优化支持
with-iconv-dir iconv函数,对字符集间的转换
with-freetype-dir 打开对freetype字体库的支持
with-jpeg-dir 打开对jpeg图片的支持
with-png-dir 打开对png图片的支持
with-zlib 打开zlib库的支持
with-libxml-dir 打开libxml2库的支持
enable-xml 打开xml的支持
enable-inline-optimization 优化线程
with-curl 打开curl浏览工具的支持
with-curlwrappers 运用curl工具打开url流
enable-mbregex 打开对mbregex的支持
enable-mbstring 多字节,字符串的支持
with-mcrypt 算法
with-gd 打开gd库的支持
enable-gd-native-ttf 支持TrueType字符串函数库
with-openssl openssl的支持,加密传输时用到的
with-mhash 算法
enable-pcntl freeTDS需要用到的,可能是链接mssql 才用到
enable-sockets 打开 sockets 支持
with-ldap Include LDAP support
with-ldap-sasl LDAP: Include Cyrus SASL support
with-xmlrpc 打开xml-rpc的c语言
enable-zip 打开对zip的支持
enable-soap Enable SOAP support
with-gettext 打开gnu 的gettext 支持,编码库用到
错误一:
You’ve configured multiple SAPIs to be build. You can build only |
| one SAPI module and CLI binary at the same time.
./configure –prefix=/usr/local/php –with-sybase-ct=/usr –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql –with-config-file-path=/usr/local/php/etc –with-iconv-dir=/usr/local/lib –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-bcmath –with-curl –with-curlwrappers –enable-mbregex –enable-mbstring –with-mcrypt –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear
同样的编译的参数,5.4.0 可以,可是5.3.10却不行
错误二:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决办法: 安装libmcrypt
错误三:
checking Checking for ctpublic.h… configure: error: ctpublic.h missing!
解决办法:编译安装freetds,并指定–with-sybase-ct的安装目录
# ./configure –prefix=/usr/local/freetds –with-tdsver=7.1 –enable-msdblib
# make
# make install
安装后执行/usr/local/freetds/bin/tsql -C 会显示安装成功的信息
错误四:configure: error: Cannot find ldap libraries in /usr/lib.
解析办法:
# whereis ldap
# ln -s /usr/include/ldap.h /usr/local/lib64/ldap.h
错误五:这个是在php5.3.10下编译的报错,如果在php5.4.0下不会有,原因可能是php5.4.10把mysql函数库加进去了
checking for specified location of the MySQL UNIX socket… no
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!
解决办法:换php5.4.10 或者编译安装mysql 指定mysql 扩展目录
./configure –prefix=/usr/local/php –with-sybase-ct=/usr/local/freetds –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql –with-config-file-path=/usr/local/php/etc –with-iconv-dir=/usr/local/lib –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-bcmath –with-curl –with-curlwrappers –enable-mbregex –enable-mbstring –with-mcrypt –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-ldap –with-ldap-sasl
Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+——————————————————————–+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+——————————————————————–+
Thank you for using PHP.
config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating main/php_config.h
config.status: executing default commands
# make ZEND_EXTRA_LIBS=’-liconv’
# make install
===========================php5.4================================================================================================================
# ./configure –prefix=/usr/local/php –with-sybase-ct=/usr/local/freetds –with-apxs2=/usr/local/apache2/bin/apxs –with-pdo-mysql –with-mysql –with-config-file-path=/usr/local/php/etc –with-iconv-dir=/usr/local/lib –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-bcmath –with-curl –with-curlwrappers –enable-mbregex –enable-mbstring –with-mcrypt –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear
===========================php5.3.10参数=========================================================================================================
# ./configure –prefix=/usr/local/php –with-sybase-ct=/usr/local/freetds –with-apxs2=/usr/local/apache2/bin/apxs –with-pdo-mysql=/usr/local/mysql –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-config-file-path=/usr/local/php/etc –with-iconv-dir=/usr/local/lib –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-bcmath –with-curl –with-curlwrappers –enable-mbregex –enable-mbstring –with-mcrypt –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear
********************************************************** mysql*************************************************************
./configure –prefix=/usr/local/mysql/ –enable-assembler –with-extra-charsets=complex –enable-thread-safe-client –with-big-tables –with-readline –with-ssl –with-embedded-server –enable-local-infile –with-plugins=partition,innobase,myisammrg
@安装libiconv
#wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
#tar zxvf libiconv-1.14.tar.gz
#cd libiconv-1.14
#./configure –prefix=/usr/local ====这里的路径必须是这个,不然php编译会出错
#make && make install
@安装libmcrypt
#wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz
#tar zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make && make install
#/sbin/ldconfig
#cd libltdl/
#./configure –enable-ltdl-install
#make & make install
@安装mhash
#wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz
#tar zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./configure
#make && make install
#cd ../
#ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
#ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
#ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
#ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
#ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
#ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
#ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
#ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
#ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
#ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
@安装mcrypt
#wget http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
#tar zxvf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#./configure
#make && make install
运维手记:http://blog.mglog.net 编译安装php、apache常见参数及错误