1 #安装php
1 #安装php
2 #备注:php5.3.3以后的版本源码不需要打php-fpm补丁,该补丁已经集成进5.3.3,在编译时,不需再--enable-fastcgi了,在php5.3.3中强制启用fastcgi.
3 [root@dba01 nginx-1.2.7]# cd
4 [root@dba01 ~]# tar -zxvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8
5
6 [root@dba01 libmcrypt-2.5.8]# ./configure && make && make install
7
8
9 [root@dba01 libmcrypt-2.5.8]# cd
10 [root@dba01 ~]# tar -zxvf mhash-0.9.9.9.tar.gz && cd mhash-0.9.9.9
11
12 [root@dba01 mhash-0.9.9.9]# ./configure && make && make install
13
14
15 [root@dba01 mhash-0.9.9.9]# cd ..
16 [root@dba01 ~]# tar -zxvf mcrypt-2.6.8.tar.gz && cd mcrypt-2.6.8
17 config.status: executing default commands
18 [root@dba01 mcrypt-2.6.8]# LD_LIBRARY_PATH=/usr/local/lib ./configure --prefix=/usr/local/
19 [root@dba01 mcrypt-2.6.8]# make && make install
错误提示:
configure: error: *** libmcrypt was not found
为了的到mcrypt.so库文件,先后安装编译了mhash和libmcrypt,但是到最后编译mcrypt时报错:
configure: error: *** libmcrypt was not found
最后发现是因为环境变量的问题,gcc编译的时候根据自身定义的变量寻找相关函数库等文件,libmcrypt也是刚安装的,在变量中没有定义出来,所以手动添加:
[root@localhost modules]# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
1 [root@dba01 mcrypt-2.6.8]# cd ..
2 [root@dba01 ~]# tar -zxvf libiconv-1.14.tar.gz
1 [root@dba01 ~]# cd libiconv-1.14
2 [root@dba01 libiconv-1.14]# ./configure && make && make install
3 [root@dba01 libiconv-1.14]# cd
1 [root@dba01 ~]# useradd -g nginx nginx -s /sbin/nologin
2 [root@dba01 ~]# tar -zxvf php-5.3.11.tar.gz
1 [root@dba01 ~]# cd php-5.3.11
2 [root@dba01 php-5.3.11]# ./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-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap
错误:
1 .编译的中报错信息:
2 configure:error:libjpeg.(a|so) not found
3
4 检查依赖包是否有安装
5 rpm -qa |grep libjpeg
6 libjpeg-6b-37
7 libjpeg-devel-6b-37
8
9 4.因为是64位系统,可能系统找不到库文件,所以只能手动复制个
10 \cp -frp /usr/lib64/libjpeg.* /usr/lib/
11 这样就可以把error:libjpeg.(a|so) not found解决
12
13 5.还有几个错误也一样的解决办法:
14 Configure: error: libpng.(also) not found.的解决办法:
15
16 \cp -frp /usr/lib64/libpng* /usr/lib/
17
18 configure: error: Cannot find ldap libraries in /usr/lib.的解决办法:
19
20 cp -frp /usr/lib64/libldap* /usr/lib/
1 [root@dba01 php-5.3.11]# make ZEND_EXTRA_LIBS='-liconv'
2 [root@dba01 php-5.3.11]# make install
3 [root@dba01 php-5.3.11]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
4 [root@dba01 php-5.3.11]# cp -rf php.ini-production /usr/local/php/etc/php.ini
5 [root@dba01 php-5.3.11]# chmod +x /etc/init.d/php-fpm
6 [root@dba01 php-5.3.11]# chkconfig php-fpm on
7 [root@dba01 php-5.3.11]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
在安装php的make时候,出现错误"chmod: cannot access `ext/phar/phar.phar': No such file or directory"的解决办法
在对php进行configure的时候,只需要在./configure的后面加上--without-pear 即可
本文来自博客园,作者:IT老登,转载请注明原文链接:https://www.cnblogs.com/nb-blog/p/5280368.html