代码改变世界
[登录 · 注册]
  • CentOS7.x 默认php版本与php7.4共存
  • 1、下载php后解压

    tar xvzf php-7.4.3.tar.gz
    cd php-7.4.3

    2、安装依赖

    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 oniguruma oniguruma-devel sqlite-devel

    3、编译  默认指定安装目录  /usr/local/php7  默认php.ini目录  /usr/local/php7/etc/php.in  与原有php5.x不冲突

    ./configure 
    --prefix=/usr/local/php7 
    --with-config-file-path=/usr/local/php7/etc 
    --enable-fpm 
    --with-fpm-user=nginx  
    --with-fpm-group=nginx 
    --enable-inline-optimization 
    --disable-debug 
    --disable-rpath 
    --enable-shared  
    --enable-soap 
    --with-libxml-dir 
    --with-xmlrpc 
    --with-openssl 
    --with-mcrypt 
    --with-mhash 
    --with-pcre-regex 
    --with-sqlite3 
    --with-zlib 
    --enable-bcmath 
    --with-iconv 
    --with-bz2 
    --enable-calendar 
    --with-curl 
    --with-cdb 
    --enable-dom 
    --enable-exif 
    --enable-fileinfo 
    --enable-filter 
    --with-pcre-dir 
    --enable-ftp 
    --with-gd 
    --with-openssl-dir 
    --with-jpeg-dir 
    --with-png-dir 
    --with-zlib-dir  
    --with-freetype-dir 
    --enable-gd-native-ttf 
    --enable-gd-jis-conv 
    --with-gettext 
    --with-gmp 
    --with-mhash 
    --enable-json 
    --enable-mbstring 
    --enable-mbregex 
    --enable-mbregex-backtrack 
    --with-libmbfl 
    --with-onig 
    --enable-pdo 
    --with-mysqli=mysqlnd 
    --with-pdo-mysql=mysqlnd 
    --with-zlib-dir 
    --with-pdo-sqlite 
    --with-readline 
    --enable-session 
    --enable-shmop 
    --enable-simplexml 
    --enable-sockets  
    --enable-sysvmsg 
    --enable-sysvsem 
    --enable-sysvshm 
    --enable-wddx 
    --with-libxml-dir 
    --with-xsl 
    --enable-zip 
    --enable-mysqlnd-compression-support 
    --with-pear 
    --enable-opcache
    make -j && make install

    4、初始化配置文件

    cp php.ini-production /usr/local/php7/etc/php.ini
    cp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm
    cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
    cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf

    #php-fpm 端口可在 www.conf 里修改

    chmod +x /etc/init.d/php7-fpm
    
    /etc/init.d/php7-fpm start

    # php7加入环境变量
    ln -s /usr/local/php7/bin/php /usr/local/bin/php7

    5、可能出现的问题

  • 上一篇:centos7.7 clamav 查杀病毒
    下一篇:centos6.5 yum安装redis
  • 【推广】 阿里云小站-上云优惠聚集地(新老客户同享)更有每天限时秒杀!
    【推广】 云服务器低至0.95折 1核2G ECS云服务器8.1元/月
    【推广】 阿里云老用户升级四重礼遇享6.5折限时折扣!
  • 原文:https://www.cnblogs.com/dwj192/p/12467268.html
走看看 - 开发者的网上家园