溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

centos7源碼安裝php7

發(fā)布時間:2020-03-02 15:08:46 來源:網(wǎng)絡 閱讀:718 作者:Lee_吉 欄目:web開發(fā)
  1. 創(chuàng)建用戶:
    useradd  -s  /sbin/nologin  -M  nginx
  2. 安裝依賴:
    yum  -y  install  libxml2  libxml2-devel
    yum  -y  install  curl-devel  libjpeg-devel  libpng-devel  freetype-devel
    yum  -y  install  libicu-devel
    yum  -y  install  libxslt-devel
    yum  -y  install  openssl  openssl-devel
  3. 解壓:
    tar -xzf php-7.2.13.tar.gz
  4. 進入目錄:
    cd php-7.2.13
  5. 編譯:
    ./configure  \
    --prefix=/data/php   \
    --with-config-file-path=/data/php/etc  \
    --enable-fpm  \
    --with-fpm-user=nginx  \
    --with-fpm-group=nginx  \
    --enable-mysqlnd  \
    --with-mysqli=mysqlnd  \
    --with-pdo-mysql=mysqlnd  \
    --with-iconv-dir  \
    --with-freetype-dir=/usr/local/freetype  \
    --with-jpeg-dir  \
    --with-png-dir  \
    --with-zlib  \
    --with-libxml-dir=/usr  \
    --enable-xml  \
    --disable-rpath  \
    --enable-bcmath  \
    --enable-shmop  \
    --enable-sysvsem  \
    --enable-inline-optimization  \
    --with-curl  \
    --enable-mbregex  \
    --enable-mbstring  \
    --enable-intl  \
    --enable-pcntl  \
    --enable-ftp  \
    --with-gd  \
    --with-openssl  \
    --with-mhash  \
    --enable-pcntl  \
    --enable-sockets  \
    --with-xmlrpc  \
    --enable-zip  \
    --enable-soap  \
    --with-gettext  \
    --disable-fileinfo  \
    --enable-opcache  \
    --enable-maintainer-zts  \
    --with-xsl
  6. 安裝:
    make  &&  make  install
  7. 添加環(huán)境變量:
    echo  'export  PATH=$PATH:/data/php/bin/'  >>  /etc/profile
    echo  'export  PATH=$PATH:/data/php/sbin/'  >>  /etc/profile
    .  /etc/profile
  8. 復制配置文件:
    cp  php.ini-production  /data/php/etc/php.ini
  9. 編輯配置文件:
    vim /data/php/etc/php.ini
    [PHP]
    engine = On
    short_open_tag = Off
    precision = 14
    output_buffering = 4096
    zlib.output_compression = Off
    implicit_flush = Off
    unserialize_callback_func =
    serialize_precision = -1
    disable_functions =
    disable_classes =
    zend.enable_gc = On
    expose_php = On
    max_execution_time = 30
    max_input_time = 60
    memory_limit = 512M
    error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
    display_errors = on
    display_startup_errors = Off
    log_errors = On
    log_errors_max_len = 1024
    ignore_repeated_errors = Off
    ignore_repeated_source = Off
    report_memleaks = On
    html_errors = On
    variables_order = "GPCS"
    request_order = "GP"
    register_argc_argv = Off
    auto_globals_jit = On
    post_max_size = 8M
    auto_prepend_file =
    auto_append_file =
    default_mimetype = "text/html"
    default_charset = "UTF-8"
    doc_root =
    user_dir =
    enable_dl = Off
    file_uploads = On
    upload_max_filesize = 20M
    max_file_uploads = 20
    allow_url_fopen = On
    allow_url_include = Off
    default_socket_timeout = 99999999
    date.timezone = PRC
    [CLI Server]
    cli_server.color = On
    [Date]
    [filter]
    [iconv]
    [intl]
    [sqlite3]
    [Pcre]
    [Pdo]
    [Pdo_mysql]
    pdo_mysql.cache_size = 2000
    pdo_mysql.default_socket=
    [Phar]
    [mail function]
    SMTP = localhost
    smtp_port = 25
    mail.add_x_header = Off
    [ODBC]
    odbc.allow_persistent = On
    odbc.check_persistent = On
    odbc.max_persistent = -1
    odbc.max_links = -1
    odbc.defaultlrl = 4096
    odbc.defaultbinmode = 1
    [Interbase]
    ibase.allow_persistent = 1
    ibase.max_persistent = -1
    ibase.max_links = -1
    ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
    ibase.dateformat = "%Y-%m-%d"
    ibase.timeformat = "%H:%M:%S"
    [MySQLi]
    mysqli.max_persistent = -1
    mysqli.allow_persistent = On
    mysqli.max_links = -1
    mysqli.cache_size = 2000
    mysqli.default_port = 3306
    mysqli.default_socket =
    mysqli.default_host =
    mysqli.default_user =
    mysqli.default_pw =
    mysqli.reconnect = Off
    [mysqlnd]
    mysqlnd.collect_statistics = On
    mysqlnd.collect_memory_statistics = Off
    [OCI8]
    [PostgreSQL]
    pgsql.allow_persistent = On
    pgsql.auto_reset_persistent = Off
    pgsql.max_persistent = -1
    pgsql.max_links = -1
    pgsql.ignore_notice = 0
    pgsql.log_notice = 0
    [bcmath]
    bcmath.scale = 0
    [browscap]
    [Session]
    session.save_handler = files
    session.use_strict_mode = 0
    session.use_cookies = 1
    session.use_only_cookies = 1
    session.name = PHPSESSID
    session.auto_start = 0
    session.cookie_lifetime = 0
    session.cookie_path = /
    session.cookie_domain =
    session.cookie_httponly =
    session.serialize_handler = php
    session.gc_probability = 1
    session.gc_divisor = 1000
    session.gc_maxlifetime = 1440
    session.referer_check =
    session.cache_limiter = nocache
    session.cache_expire = 180
    session.use_trans_sid = 0
    session.sid_length = 26
    session.trans_sid_tags = "a=href,area=href,frame=src,form="
    session.sid_bits_per_character = 5
    [Assertion]
    zend.assertions = -1
    [COM]
    [mbstring]
    [gd]
    [exif]
    [Tidy]
    tidy.clean_output = Off
    [soap]
    soap.wsdl_cache_enabled=1
    soap.wsdl_cache_dir="/tmp"
    soap.wsdl_cache_ttl=86400
    soap.wsdl_cache_limit = 5
    [sysvshm]
    [ldap]
    ldap.max_links = -1
    [dba]
    [opcache]
    [curl]
    [openssl]
  10. 創(chuàng)建php-fpm配置文件:
    vim /etc/php-fpm.conf
    [global]
    pid = /var/run/php-fpm.pid
    error_log = /var/log/php-fpm.log
    log_level = notice
    [nginx]
    listen = 127.0.0.1:9000
    listen.backlog = -1
    listen.allowed_clients = 127.0.0.1
    listen.owner = nginx
    listen.group = nginx
    listen.mode = 0666
    user = nginx
    group = nginx
    pm = dynamic
    pm.max_children = 20
    pm.start_servers = 10
    pm.min_spare_servers = 10
    pm.max_spare_servers = 20
    request_terminate_timeout = 100
    request_slowlog_timeout = 0
    slowlog = var/log/slow.log
  11. 啟動php-fpm:
    /data/php/sbin/php-fpm --fpm-config /etc/php-fpm.conf
  12. 停止php-fpm:
    pkill  php-fpm

    廣告

    給大家推薦幾個好用的工具

  13. 時間校驗工具
  14. ip查詢工具
  15. 二維碼生成工具
  16. json格式化工具
  17. 時間綴-時間轉換工具
向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI