Linux学习笔记
当前位置:Linux学习笔记 > PHP教程 > 正文

php7正式版编译安装教程

bbs.yuanmawu.net.jpg
1、下载php7包,地址:

http://php.net/get/php-7.0.0.tar.gz/from/a/mirror
2、解压,进入PHP目录
  1. tar zxvf php-7.0.0.tar.gz
  2. cd php-7.0.0

复制代码

3、安装依赖包,我用的centos,偷下懒,直接yum安装
  1. yum install -y gcc gcc-c++  make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

复制代码

4、/alidata/server/php-7.0/ 为我的PHP安装目录,一般是在/usr/local下,大家按照自己的习惯替换
  1. ./configure –prefix=/alidata/server/php-7.0 \
  2. –with-config-file-path=/alidata/server/php-7.0/etc \
  3. –with-mysql=mysqlnd \
  4. –with-pdo-mysql=mysqlnd \
  5. –with-mysqli=mysqlnd \
  6. –with-gd \
  7. –with-iconv \
  8. –with-zlib \
  9. –enable-xml \
  10. –enable-bcmath \
  11. –enable-shmop \
  12. –enable-sysvsem \
  13. –enable-inline-optimization \
  14. –enable-mbregex \
  15. –enable-fpm \
  16. –enable-mbstring \
  17. –enable-ftp \
  18. –enable-gd-native-ttf \
  19. –with-openssl \
  20. –enable-pcntl \
  21. –enable-sockets \
  22. –with-xmlrpc \
  23. –enable-zip \
  24. –enable-soap \
  25. –without-pear \
  26. –with-gettext \
  27. –enable-session \
  28. –with-mcrypt \
  29. –with-curl \
  30. –with-jpeg-dir \
  31. –with-freetype-dir \
  32. –with-xpm-dir=/usr \
  33. –with-bz2

复制代码

5、make && make install
6、安装完成后

  1. cp php.ini-production /alidata/server/php-7.0/etc/php.ini
  2. cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
  3. cp php-fpm.conf.default php-fpm.conf
  4. cp www.conf.default www.conf

复制代码

7、建立软链接

  1. ln -s /alidata/server/php-7.0/bin/php /usr/bin/php
  2. ln -s /alidata/server/php-7.0/sbin/php-fpm /usr/bin/php-fpm

复制代码

8、php -v

未经允许不得转载:Linux学习笔记 » php7正式版编译安装教程

赞 (0)
分享到:更多 ()