注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

成功源于细节

梦想、奋斗、收获

 
 
 

日志

 
 
 
 

php5.6编译安装参数  

2016-06-19 17:00:23|  分类: php |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
centos 6.5可以先安装以下编译库
yum install gcc
yum install -y perl* 
yum install libxml2 libxml2-devel -y
yum -y install curl-devel
yum install -y httpd-devel
yum install -y bzip2 bzip2-devel
yum install -y openssl openssl-devel
yum -y install libjpeg-devel
yum -y install libpng-devel
yum -y install freetype-devel
cp -frp /usr/lib64/libldap* /usr/lib/
yum -y install php-mcrypt libmcrypt libmcrypt-devel



./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2 --with-libxml-dir --with-config-file-path=/etc/httpd/conf --with-mysql --with-mysqli --with-gd --enable-gd-native-ttf --with-zlib --with-mcrypt=/usr/local/libmcrypt --with-pdo-mysql --enable-shmop --enable-soap --enable-sockets --enable-wddx --enable-zip --with-xmlrpc --enable-fpm --enable-mbstring --with-zlib-dir --with-bz2 --with-curl --enable-exif --enable-ftp --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-freetype-dir=/usr/lib/ --with-openssl --with-kerberos --enable-calendar --with-mhash --with-ldap --with-mssql --enable-opcache --enable-mysqlnd

make && make install

.....................
Generating phar.php
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
pharcommand.inc
directorygraphiterator.inc
directorytreeiterator.inc
clicommand.inc
invertedregexiterator.inc
phar.inc

Build complete.
Don't forget to run 'make test'.

Installing PHP SAPI module:       apache2handler
/usr/lib/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib/apr-1/build/libtool' libphp5.la /usr/lib/httpd/modules
/usr/lib/apr-1/build/libtool --mode=install cp libphp5.la /usr/lib/httpd/modules/
libtool: install: cp .libs/libphp5.so /usr/lib/httpd/modules/libphp5.so
libtool: install: cp .libs/libphp5.lai /usr/lib/httpd/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /root/install/php-5.6.22/libs'
chmod 755 /usr/lib/httpd/modules/libphp5.so
[activating module `php5' in /etc/httpd/conf/httpd.conf]
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
Installing PHP CLI binary:        /usr/local/php/bin/
Installing PHP CLI man page:      /usr/local/php/php/man/man1/
Installing PHP FPM binary:        /usr/local/php/sbin/
Installing PHP FPM config:        /usr/local/php/etc/
Installing PHP FPM man page:      /usr/local/php/php/man/man8/
Installing PHP FPM status page:   /usr/local/php/php/php/fpm/
Installing PHP CGI binary:        /usr/local/php/bin/
Installing PHP CGI man page:      /usr/local/php/php/man/man1/
Installing build environment:     /usr/local/php/lib/php/build/
Installing header files:           /usr/local/php/include/php/
Installing helper programs:       /usr/local/php/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php/lib/php/
[PEAR] Archive_Tar    - installed: 1.4.0
[PEAR] Console_Getopt - installed: 1.4.1
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.3.0
[PEAR] PEAR           - installed: 1.10.1
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/install/php-5.6.22/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers:           /usr/local/php/include/php/ext/pdo/
[root@yue php-5.6.22]# 


遇到的问题都是yum install -y XXX-devel可以解决,下面是一个比难慢的问题也解决了:

configure: error: mcrypt.h not found. Please reinstall libmcrypt  

我是在CentOS6.5安装php5.5.28这个版本,PHP编译代码如下:

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --with-fpm-user=php --with-fpm-group=php --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pear --with-gettext --enable-session  --with-curl --enable-exif


安装过程不再赘述。因为在编译安装时没有把mcrypt这个扩展编译进去,所以在phpmyadmin里有这样一句提示:

缺少 mcrypt 扩展。请检查 PHP 配置。

另外在独立安装mycrypt扩展时,报错:

configure: error: mcrypt.h not found. Please reinstall libmcrypt.


现在把mcrypt扩展安装过程贴出来,希望对遇到此类问题的朋友有帮助:


1.首先编译安装  libmcrypt,  mhash,  mcrypt  二进制源码包。


========================================

下载libmcrypt-2.5.8.tar.gz

tar zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure --prefix=/usr/local/libmcrypt

make 

make install


=========================================

下载mhash-0.9.9.9.tar.gz

tar zxvf mhash-0.9.9.9

cd mhash-0.9.9.9

./configrue --prefix=/usr/local/mhash

make

make install


=========================================

tar zxvf mcrypt-2.6.8.tar.gz

cd mcrypt-2.6.8

export LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/mhash/lib

export LDFLAGS="-L/usr/local/mhash/lib -I/usr/local/mhash/include/"

export CFLAGS="-I/usr/local/mhash/include/"

./configure --prefix=/usr/local/mcrypt --with-libmcrypt-prefix=/usr/local/libmcrypt

make

make install

=========================================


cd /usr/local/src/develop/php-5.5.28/ext/mcrypt

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config  --with-mcrypt=/usr/local/libmcrypt

make

make install

生成的mcrypt.so文件已经被发送到 /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so

因为我在php.ini设置extension_dir = /usr/local/php/extensions,

所以需要执行:

cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so  /usr/local/php/extensions

然后在php.ini里面添加:
extension=mcrypt.so
重启php,执行: service php-fpm restart
运行phpinfo(),发现新增了mcrypt扩展项,而且phpmyadmin里面关于mcrypt的提示也不见了。


在安装过程中走了弯路,一度鄙视这种编译安装方式,多亏了这位大神发的帖子帮忙。
详见: http://segmentfault.com/q/1010000000094627


==============================================================
64位Centos报错:
configure: error: Cannot find ldap libraries in /usr/lib.
解决方法是执行命令: cp -frp /usr/lib64/libldap* /usr/lib/

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

#方法(关键点在用 2.5.7版本):

#使用wget可以通过以下路径下载
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz

#解压
tar -zxvf libmcrypt-2.5.7.tar.gz

#进入目录
cd libmcrypt-2.5.7

#编译(默认安装到/usr/local/lib/)
./configure --prefix=/usr/local/libmcrypt

#执行安装
make && make install

  评论这张
 
阅读(235)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017