• php源码下载地址
  • http://cn2.php.net/get/php-5.4.45.tar.gz/from/this/mirror
  • http://cn2.php.net/get/php-5.4.36.tar.gz/from/this/mirror
  • http://cn2.php.net/get/php-5.5.31.tar.gz/from/this/mirror
  • http://kr1.php.net/get/php-5.5.38.tar.gz/from/this/mirror
  • http://kr1.php.net/get/php-5.6.30.tar.gz/from/this/mirror
  • http://cn2.php.net/get/php-7.0.2.tar.gz/from/this/mirror
  • http://kr1.php.net/get/php-7.0.6.tar.gz/from/this/mirror
  • http://kr1.php.net/get/php-7.0.18.tar.gz/from/this/mirror
  • http://jp2.php.net/get/php-7.0.24.tar.gz/from/this/mirror
  • http://cn2.php.net/get/php-7.1.10.tar.gz/from/this/mirror
  • #php下载地址
  • http://windows.php.net/downloads/releases/archives/
  • http://blog.itpub.net/7607759/viewspace-712351/

  

  #添加组groupadd www

  #添加php-fpm用户

  useradd -c php-fpm-user -g www -M php-fpm

  # c和c++编译器

  yum install -y gcc gcc-c++

  # PHP扩展依赖

 

 


yum install -y gcc gcc-c++ autoconf libxml libxml2-devel libcurl libcurl-devel libpng libpng-devel freetype freetype-devel gd gd-devel libjpeg libjpeg-devel openssl libvpx libvpx-devel libmcrypt libmcrypt-devel ncurses ncurses-devel wget openssl openssl-devel pcre pcre-devel vim cmake bzip2

 

 

 

 

yum install -y 
openssl openssl-devel libcurl-devel gd gd-devel libjpeg  libjpeg-devel libpng libpng-devel
freetype freetype-devel
libpng-devel libicu-devel 
openldap-devel 
autoconf automake libxml2 libxml2-devel
pcre-devel   curl-devel  zlib-devel ncurses-devel 

 

 

./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc  --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --enable-bcmath --enable-shmop   --with-curl  --enable-fpm --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl  --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-ftp --enable-pcntl --with-pear   

 

 

  ###########################编译参数之一###################################

  


./configure --prefix=/data/soft/php\ --with-libdir=lib64 \ --enable-fpm \ --with-fpm-user=php-fpm \ --with-fpm-group=www \ --enable-mysqlnd \ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-opcache \ --enable-pcntl \ --enable-mbstring \ --enable-soap \ --enable-sockets \ --enable-zip \ --enable-calendar \ --enable-bcmath \ --enable-exif \ --enable-ftp \ --enable-intl \ --with-openssl \ --with-zlib \ --with-curl \ --with-gd \ --with-zlib-dir=/usr/lib \ --with-png-dir=/usr/lib \ --with-jpeg-dir=/usr/lib \ --with-gettext \ --with-mhash\ --with-ldap \
--with-pear
  ############   
--enable-gd-native-ttf \


 

 

 

###########################编译参数之选择##################################


./configure --prefix=/usr/local/php7182\
--with-config-file-path=/usr/local/php7182/etc\
--enable-mysqlnd\
--with-mysqli=mysqlnd\
--with-pdo-mysql=mysqlnd\
--enable-sockets\
--enable-soap\
--enable-pcntl\
--enable-soap\
--enable-sockets\
--with-openssl\
--with-curl\
--enable-mbstring\
--enable-mysqlnd\
--enable-fpm\
--enable-bcmath\
--with-xmlrpc\
--with-zlib\
--with-pear\
--with-gd \
--with-iconv \
--enable-xml \
--enable-bcmath \
--enable-opcache \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--with-mcrypt=/usr/local/libmcrypt

 

编译完一些后续工作
# 设置php-fpm开机自动启动

chmod +x /etc/init.d/php-fpm
chkconfig php-fpm on
cp /data/soft/php/etc/php-fpm.conf.default /data/soft/php/etc/php-fpm.conf
service php-fpm start

  

 

注意 opcache >=php5.5 才支持

#修改环境变量 vi ~./bash_profile

enable-opcache
PHP编译字节码缓存,如果需要将 Xdebug 扩展和 OPcache 一起使用,必须在 Xdebug 扩展之前加载 OPcache 扩展

使用以下配置可使PHP活得较好性能

opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

 

enable-soap 简单对象访问协议,使用xml传输数据,目前已经不常用
enable-zip zip文件处理
enable-calendar 日历处理
enable-bcmath 任意精度数学扩展
enable-exif
exif(可交换图像文件格式),专门为数码相机和照片设定,记录数码照片的属性信息和拍摄数据

 

 

 

  ##################### 

Windows 用户必须在 php.ini 中启用 php_mbstring.dll 和 php_exif.dll 扩展。 请确保在 php.ini 中保持正确的顺序:
php_mbstring.dll 必须在 php_exif.dll 之前 加载。

enable-intl 国际化支持
enable-mbstring 宽字符支持
with-gettext 语言翻译
with-mhash hash库支持
with-ldap ldap支持
with-libdir=lib64 如果64位操作系统,指定为/usr/lib64为默认库路径

 

posted on 2017-10-07 23:29  千魔  阅读(170)  评论(0编辑  收藏  举报