• Linux下源码编译php7


    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  libxslt libxslt-devel libzip
    

    2.下载php7安装

    wget http://cn2.php.net/distributions/php-7.3.0.tar.gz
    

    3.解压、编译安装

    tar zxvf php-7.3.0.tar.gz
    cd php-7.3.0
    #配置
    ./configure --prefix=/usr/local/php 
    --with-curl 
    --with-freetype-dir 
    --with-gd 
    --with-gettext 
    --with-iconv-dir 
    --with-kerberos 
    --with-libdir=lib64 
    --with-libxml-dir 
     --with-mysqli 
    --with-openssl 
    --with-pcre-regex 
    --with-pdo-mysql 
    --with-pdo-sqlite 
    --with-pear 
    --with-png-dir 
    --with-xmlrpc 
    --with-xsl 
     --with-zlib 
    --enable-fpm 
    --enable-bcmath 
    --enable-libxml 
    --enable-inline-optimization 
    --enable-mbregex 
    --enable-mbstring 
    --enable-opcache 
    --enable-pcntl 
    --enable-shmop 
    --enable-soap 
    --enable-sockets 
    --enable-sysvsem 
    --enable-xml 
    --enable-zip
    #编译
    make
    #安装
    make install
    
    • 编译中遇到的错误
    1.Libzip 版本过低或提示reinstall解决方法
    yum remove libzip -y
    wget https://nih.at/libzip/libzip-1.2.0.tar.gz
    tar -zxvf libzip-1.2.0.tar.gz
    cd libzip-1.2.0
    ./configure
    make && make install
    
    2.configure: error: off_t undefined; check your library configuration
    echo '/usr/local/lib64
    /usr/local/lib
    /usr/lib
    /usr/lib64'>>/etc/ld.so.conf&&ldconfig -v
    
    3./usr/local/include/zip.h:59:21: 致命错误:zipconf.h:没有那个文件或目录
    cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
    

    4.配置

    • 在之前编译的源码包中,找到 php.ini-production,复制到/usr/local/php下,并改名为php.ini
    [root@MiWiFi-R3P-srv php-7.3.0]# pwd
    /usr/local/php-7.3.0
    [root@MiWiFi-R3P-srv php-7.3.0]# cp php.ini-production /usr/local/php/etc/php.ini
    
    • 显示错误信息
    vim /usr/local/php/php.ini 
    修改display_errors = On
    
    • 复制启动脚本
    [root@MiWiFi-R3P-srv fpm]# pwd
    /usr/local/php-7.3.0/sapi/fpm
    [root@MiWiFi-R3P-srv fpm]# cp init.d.php-fpm /etc/init.d/php-fpm 
    [root@MiWiFi-R3P-srv fpm]# chmod a+x /etc/init.d/php-fpm
    
    [root@MiWiFi-R3P-srv etc]# pwd
    /usr/local/php/etc
    [root@MiWiFi-R3P-srv etc]# cp php-fpm.conf.default php-fpm.conf
    [root@MiWiFi-R3P-srv etc]# vim php-fpm.conf
    修改去掉 pid = run/php-fpm.pid 前面的分号
    
    [root@MiWiFi-R3P-srv php-fpm.d]# pwd
    /usr/local/php/etc/php-fpm.d
    [root@MiWiFi-R3P-srv php-fpm.d]# cp www.conf.default www.conf
    
  • 相关阅读:
    方差分析
    Rust 指定安装目录
    perl 子函数传入多个数组
    perl 获取目录信息
    R绘图布局包 customLayout
    C语言 自定义函数按行读入文件2
    C语言 自定义函数按行读入文件
    C语言按行读入文件
    sed删除指定行
    mybatis 批量更新
  • 原文地址:https://www.cnblogs.com/zhangjianqiang/p/10145233.html
Copyright © 2020-2023  润新知