ARM Centos7 编译安装PHP

  • Post author:
  • Post category:php


  1. 下载源包
  2. 安装依赖包

    yum install  openssl-devel bzip2-devel libffi-devel  sqlite-devel gpm-libs oniguruma oniguruma-devel libsodium libsodium-devel xz-devel libxml2-devel libcurl-devel
    yum install  bash-completion bash-completion-extras libicu-devel libjpeg libjpeg-devel  nss_ldap cmake  boost-devel libevent libevent-devel gd gd-devel openjpeg-devel 
    yum install  libgcrypt-devel libpng-devel libgpg-error-devel libxslt-devel cmake libmcrypt-devel libmcrypt  recode-devel recode  
    
    
  3. 编译

    tar -zxf php-7.4.28.tar.gz 
    cd php-7.4.28
    ./configure --prefix=/workspace/app/php --with-config-file-path=/workspace/app/php/etc --with-fpm-user=nginx --with-fpm-group=nginx --with-curl  --enable-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64  --with-mysqli --with-openssl  --with-pdo-mysql --with-pdo-sqlite --with-pear   --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath  --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml  --enable-fpm  --with-freetype --with-jpeg  --with-xpm
    
    #安装
    make 
    make install
    
    注意:--enable-gd-jis-conv  
      如果PHP编译时启用–enable-gd-jis-conv选项的话,那么非ASCII字符(例如汉字、拼音、希腊文和箭头) 会被当成EUC-JP编码 (phpinfo中美其名曰“支持JIS编码的字体”), 从而导致乱码(由于西文字体没有假名或汉字,一般表现为全部是方框)。
  4. 配置环境变量

    vim /etc/profile 
    PATH=/workspace/app/php/bin:/workspace/app/php/sbin:$PATH
    source /etc/profile
    # 输入 php -v 检查是否安装成功,环境变量并生效。
  5. 配置PHP

    cp php.ini-production  /workspace/app/php/etc/php.ini
    cp /workspace/app/php/etc/php-fpm.conf.default /workspace/app/php/etc/php-fpm.conf
    cp /workspace/app/php/etc/php-fpm.d/www.conf.default /workspace/app/php/etc/php-fpm.d/www.conf
    cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
    chmod +x /etc/init.d/php-fpm

  6. 启动服务
groupadd nginx
useradd -g nginx -s /sbin/nologin nginx
/etc/init.d/php-fpm start 



版权声明:本文为m0_57490668原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。