1安装必备库
cd /usr/local/src wget http://us1.php.net/distributions/php-5.5.4.tar.gz wget http://superb-dca2.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
yum -y install gcc gcc-c++ make cmake automake autoconf kernel-devel ncurses-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel pcre-devel libtool-libs freetype-devel gd zlib-devel file bison patch mlocate flex diffutils readline-devel glibc-devel glib2-devel bzip2-devel gettext-devel libcap-devel libmcrypt-devel openldap openldap-devel libxslt-devela
wget http://us1.php.net/distributions/php-5.5.11.tar.gza
./configure --prefix=/usr/local/php --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --enable-cli --with-config-file-path=/usr/local/php/etc --with-openssl --with-kerberos --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --enable-ftp --with-gd --enable-gd-native-ttf --with-ldap --with-ldap-sasl --enable-mbstring --enable-mbregex --enable-json --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=mysqlnd --with-pdo-sqlite --enable-pdo --enable-dba --enable-shmop --enable-soap --enable-sockets --enable-wddx --enable-fpm --with-mhash --with-mcrypt --with-iconv --with-xsl --enable-zip --with-pcre-regex --enable-dom --enable-gd-native-ttf --enable-posix --enable-fileinfo --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-xmlrpc --enable-xml --enable-xmlreader --enable-maintainer-zts --enable-opcache --with-libdir=lib64
aacp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm #因为php5.3开始自带fpm,使用自带的管理脚本 chmod +x /etc/init.d/php-fpm mkdir /usr/local/php/etc/ cp /etc/php-fpm.conf.default /etc/php-fpm.conf -Rf cp php.ini-* /usr/local/php/etc/ cp php.ini-production /usr/local/php/etc/php.ini ln -sf /usr/local/php/etc/php.ini /etc/
vi /etc/php-fpm.conf group=www user=www
echo PATH=$PATH:/usr/local/php/bin >> /etc/profile source /etc/profile
今天在CentOS 6.4 x86_64下安装PHP 5.4.7的ldap扩展库时,出现PHP configure: error: Cannot find ldap libraries in /usr/lib
错误。这个错误提示在/usr/lib 下找不到相关模块,这是因为64位的linux默认把openldap的so库文件都放在 /usr/lib64 文件夹下。有两个办法解决:
将/usr/lib64目录中所有ldap的so库拷贝到/usr/lib目录中,然后重新configure
cp -frp /usr/lib64/libldap* /usr/lib/
在configure的时候,指定
--with-libdir=lib64
转载请注明:半叶寒羽
» fedora编译安装php5.5