yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel libcurl libcurl-devel libxslt-devel openssl openssl-devellibmcrypt
./configure \
--prefix=/usr/local/php-5.5.16 \
--with-config-file-path=/usr/local/php-5.5.16/etc \
--with-mysql=/usr/local/mysql-5.6.20 \
--with-pdo-mysql=/usr/local/mysql-5.6.20 \
--with-curl \
--with-openssl \
--enable-mbstring \
--with-freetype-dir \
--enable-fpm \
--with-jpeg-dir \
--with-png-dir \
--enable-zip \
--enable-exif \
--with-imap-ssl \
--with-gd \
--with-mcrypt \
--disable-fileinfo (内存小于等于1G 就要加上,不然报错)
(--with-freetype-dir 这个是我在用laravel 的验证码不起作用的情况下,安装就可以了)
(少了mcrypt)
(--with-jpeg-dir 这个是解决Call to undefined function imagecreatefromjpeg())
(--enable-exif这个是解决Call to undefined function exif_imagetype())
# make && make install
# cp /usr/local/php-5.5.16/etc/php-fpm.conf.default /usr/local/php-5.5.16/etc/php-fpm.conf
# vim /usr/local/php-5.5.16/etc/php-fpm.conf
pid = run/php-fpm.pid
#cp /usr/local/src/php-5.5.16/php.ini-production /usr/local/php-5.5.16/etc/php.ini
(在编译php配置文件的时候地址自定的)
添加到init启动
[root@test php-5.5.7]#cp /usr/local/src/php-5.5.16/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
[root@test php-5.5.7]# chmod a+x /etc/rc.d/init.d/php-fpm
[root@test php-5.5.7]# chkconfig --add php-fpm
[root@test php-5.5.7]# chkconfig php-fpm on
[root@test php-5.5.7]# service php-fpm start
报错:ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)
解决方法:killall php-fpm然后service php-fpm start
Starting php-fpm done