zoukankan      html  css  js  c++  java
  • PHP 安装配置

    预装软件

    apt install libjpeg-turbo8-dev libmcrypt-dev
    
    ./configure  --prefix=/usr/local/php --with-libdir=/lib/x86_64-linux-gnu --with-config-file-path=/usr/local/php/etc --with-mysqli=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --enable-bcmath --enable-inline-optimization --with-curl --with-fpm-user=www --with-fpm-group=www --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-sockets --enable-zip --enable-ftp --without-pear --enable-pdo --with-pdo-mysql=mysqlnd --disable-fileinfo --with-xmlrpc --enable-opcache --enable-fpm
    

    编译安装完后,php.ini文件从源码里复制过去
    上面有一个编译参数with-config-file-path指定自己的php.ini路径,源码里面有 php.ini-development 和 php.ini-production 选一个复制过去

    php.ini 建议修改的地方:

    [PHP]
    ;时区
    date.timezone = Asia/Shanghai
    ;下面这行可以写上你用不到但又有潜在安全风险的函数,他们将不会被执行。
    disable_functions = system,passthru,exec,shell_exec,popen,phpinfo
    
    

    php-fpm.conf 文件(树莓派可用默认):

    [global]
    pid = /tmp/php-fpm.pid
    error_log = /tmp/php-fpm.log
    log_level = error
    daemonize = no
    [MainWebSite]
    listen = /tmp/php-fpm.sock
    listen.group = www
    user = www
    group = www
    pm = static
    pm.max_children = 3
    pm.start_servers = 2
    pm.min_spare_servers = 1
    pm.max_spare_servers = 3
     
    rlimit_files = 51200
    
    

    x86版:

    /usr/lib/systemd/system/php.socket 文件

    [Socket]
    ListenStream=/tmp/php-fpm.sock
     
    [Install]
    WantedBy=sockets.target
    

    /usr/lib/systemd/system/php.service 文件

    [Unit]
    Description=The PHP FastCGI Process Manager
    After=syslog.target network.target php.socket
    
    [Service]
    Environment="FPM_SOCKETS=/tmp/php-fpm.sock=3"
    ExecStart=/usr/local/php/sbin/php-fpm -c /home/etc/php.ini -y /home/etc/php-fpm.conf
    RestartSec=1s
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    

    树莓派版:

    /usr/lib/systemd/system/php.service 文件

    [Unit]
    Description=The PHP FastCGI Process Manager
    After=syslog.target network.target
    
    [Service]
    ExecStart=/usr/local/php/sbin/php-fpm -c /usr/local/php/php.ini -y /usr/local/php/php-fpm.conf -R
    RestartSec=1s
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    ~                                
    
    "随笔"类型下的内容为原创,转载请注明来源. http://www.cnblogs.com/DragonStart/
  • 相关阅读:
    AcWing 157. 树形地铁系统 (hash判断树同构)打卡
    AcWing 156. 矩阵 (哈希二维转一维查询)打卡
    AcWing 144. 最长异或值路径 01字典树打卡
    AcWing 143. 最大异或对 01字典树打卡
    AcWing 142. 前缀统计 字典树打卡
    AcWing 139. 回文子串的最大长度 hash打卡
    AcWing 138. 兔子与兔子 hash打卡
    常用C库函数功能及用法
    编程实现C库函数
    C语言面试题5
  • 原文地址:https://www.cnblogs.com/DragonStart/p/7136131.html
Copyright © 2011-2022 走看看