[关闭]
@gabe 2018-06-25T20:00:36.000000Z 字数 1720 阅读 1039

ubuntu下安装php5.6安装

未分类


在此输入正文
安装依赖

  1. sudo apt-get install libxml2-dev libssl-dev pkg-config libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libfreetype6-dev libicu-dev build-essential libmcrypt-dev libreadline-dev libxslt1-dev -y
  1. ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
  1. ./configure --prefix=/usr/local/php56 \
  2. --with-mysql-sock --with-mysqli \
  3. --enable-fpm --enable-soap \
  4. --with-libxml-dir --with-openssl \
  5. --with-mcrypt --with-mhash \
  6. --with-pcre-regex --with-zlib \
  7. --enable-bcmath --with-iconv \
  8. --with-bz2 --enable-calendar \
  9. --with-curl --with-cdb --enable-dom \
  10. --enable-exif --enable-fileinfo \
  11. --enable-filter --with-pcre-dir \
  12. --enable-ftp --with-gd \
  13. --with-openssl-dir --with-jpeg-dir \
  14. --with-png-dir --with-zlib-dir \
  15. --with-freetype-dir \
  16. --enable-gd-native-ttf \
  17. --enable-gd-jis-conv --with-gettext \
  18. --with-gmp --with-mhash \
  19. --enable-json --enable-mbstring \
  20. --enable-mbregex \
  21. --enable-mbregex-backtrack \
  22. --with-libmbfl --with-onig \
  23. --enable-pdo --with-pdo-mysql \
  24. --with-zlib-dir --with-readline \
  25. --enable-session --enable-shmop \
  26. --enable-simplexml --enable-sockets \
  27. --enable-sysvmsg --enable-sysvsem \
  28. --enable-sysvshm --enable-wddx \
  29. --with-libxml-dir --with-xsl \
  30. --enable-zip \
  31. --enable-mysqlnd-compression-support \
  32. --with-pear --enable-intl

把php56加入到系统环境变量中,做个软链即可

  1. ln -sf /usr/local/php56/bin/php /usr/local/bin/php56

添加php.ini,如果是生产环境则cp对应的php.ini-production

  1. cp php.ini-development /usr/local/php56/lib/php.ini

配置php-fpm,先添加配置文件

  1. cp /usr/local/php56/etc/php-fpm.conf.default /usr/local/php56/etc/php-fpm.conf

安装nginx

安装依赖

  1. sudo apt-get install libpcre3-dev -y
  1. ./configure

添加到系统环境中

  1. sudo ln -sf /usr/local/nginx/sbin/nginx /usr/local/bin/nginx

配置nginx

  1. location ~ \.php(/|$) {
  2. fastcgi_pass 127.0.0.1:9000;
  3. fastcgi_index index.php;
  4. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  5. include fastcgi_params;
  6. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注