centos7-install-php5.6.40
2019-05-20PHP 7.3声称速度比PHP 5快3倍还多。但是typo3 7.6.10不支持php7.3。
报错信息:Warning: count(): Parameter must be an array or an object that implements Countable
1、yum安装依赖包
yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel
readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel
ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel
xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel libzip
yum -y insatll curl curl-devel
2、yum -y install libxslt libxslt-devel
tar zxf untar/libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure && make && make install && cd ..
3、wget https://nih.at/libzip/libzip-1.2.0.tar.gz -P untar
tar -zxvf untar/libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make
make install
可能会遇到错误:/usr/local/include/zip.h:59:10: fatal error: zipconf.h: No such file or directory
#include <zipconf.h>
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
make从zip.o会继续
4、wget http://php.net/distributions/php-5.6.40.tar.gz
tar jxf untar/php-5.6.40.tar.bz2
pushd php-5.6.40
./configure \
--prefix=/usr/local/php56 \
--with-config-file-path=/usr/local/php/etc \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--with-curl \
--with-gd \
--with-xmlrpc \
--with-openssl \
--with-mhash \
--enable-zip \
--enable-fpm \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-pcntl \
--enable-sockets \
--enable-soap \
--disable-rpath \
--without-pear
#make; make install
5、编译过程中遇到的错误
configure: error: off_t undefined; check your library configuration
vim /etc/ld.so.conf
#添加如下几行
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
#保存退出
:wq
ldconfig -v # 使之生效
virtual memory exhausted: Cannot allocate memory
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
dd if=/dev/zero of=/opt/swapfile bs=1024 count=4777216
mkswap /opt/swapfile
swapon /opt/swapfile
swap -s
swapoff /opt/swapfile
6、编译安装后,
ls /usr/local/php73
ls /usr/local/php56
ln -s php56 php
find . -name "*php-fpm*"
./sapi/fpm/init.d.php-fpm
./sapi/fpm/php-fpm.conf
./sapi/fpm/php-fpm.service
./sapi/fpm/php-fpm
find . -name "php.ini*"
./php.ini-production
./php.ini-development
cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp ./sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service
cp ./php.ini-production /usr/local/php/etc/php.ini
cp ./sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf
7、增加yum -y install icu libicu-devel
wget http://pecl.php.net/get/intl-3.0.0.tgz -P untar
tar zxf untar/intl-3.0.0.tgz
cd intl-3.0.0
/usr/local/php/bin/phpize
./configure --enable-intl --with-php-config=/usr/local/php/bin/php-config
make;make install
####################################
8、安装memcache
wget http://pecl.php.net/get/memcache-3.0.8.tgz -P untar
tar zxf untar/memcache-3.0.8.tgz
cd memcache-3.0.8/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached
make ;make install
9、vi //usr/local/php/etc/php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/memcache.so
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/intl.so
启动php-fpm
/etc/init.d/php-fpm start
netstat -ntlp