centos7源码安装php7
admin
2023-02-11 20:20:08
0
  1. 创建用户:
    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. 添加环境变量:
    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. 创建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. 时间缀-时间转换工具

相关内容

热门资讯

斯里兰卡前高官之子,涉嫌抢劫中... 斯里兰卡警方近期披露,当地破获一起抢劫案,涉案人员5人,涉案金额高达2000万卢比(约合人民币40余...
每日科普 | 量子包治百病?什... 市面上量子手环、量子水杯、量子床垫、量子理疗仪等产品满天飞,商家张口就宣称量子能量可以疏通经络、根除...
上海AI产业交答卷:以生态之力... 上海人工智能产业交答卷:真实产线上淬炼硬核能力 聚合产业推进中国算力体系化 以生态之力,加速AI拐点...
“郑州造”光伏清洁机器人即将交... 7月22日,郑州航空港经济综合实验区坤达产业园内,两台C1光伏清洁机器人正在进行交付前的最后测试。作...
腾讯整合Workbuddy与Q... 快科技7月21日消息 ,据媒体报道,腾讯近日发布内部组织调整通知,将 QClaw产品中心全部相关业务...
TVB正式更名,宣布由传统电视... 7月24日,@TVB官方微博发文官宣TVB更名“无线集团”,TVB表示,由传统电视台升级为跨媒体娱乐...
2026WAIC观察丨白辰甲:... 图片来源/新华社 ■中国经济时报记者 张一鸣 王彩娜 在人工智能浪潮下,具身智能的演变之路也在加速。...
澳大利亚工党大会上,中方官员愤... 据澳大利亚广播公司(ABC)7月23日报道,中国外交官因不满台湾地区代表出席澳大利亚工党(ALP)在...
裸体在家犯法还是拍别人裸照犯法... 近日,#男子在家裸体被邻居拍照发群#一事引发热议。据报道,某小区一名男业主在家中未穿衣物,对面女业主...
“每天跟遛狗一样”,万亿资金,... 进入7月,市场波动加大,A股关于量化交易的争议再次达到顶峰。由于散户与量化机构之间的“体感温差”显著...