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/
  • 相关阅读:
    理解Java虚拟机——Java内存模型管理
    Java 使用fastjson 将 json字符串写到文件中去
    java 如何调用 linux or mac 命令行
    MacOS 编译 openjdk8 并导入 Clion 调试
    linux ls 命令超级详解
    小 Q 与树 (点分治)
    mysql 索引策略
    java中serialVersionUID作用
    通过源码分析Spring Security用户认证流程
    使用PowerMockRunner和Mockito编写单元测试用例详解
  • 原文地址:https://www.cnblogs.com/DragonStart/p/7136131.html
Copyright © 2011-2022 走看看