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/
  • 相关阅读:
    Eclipse下,修改MAVEN 中央仓库地址,解决maven下载慢问题
    C语言中头文件string的用法
    Linux中变量$#,$@,$0,$1,$2,$*,$$,$?的含义
    Curl
    LDAP是什么
    Linux网络基本网络配置
    vim
    request,session,cookie的比较
    J2EE开发过程中遇到的问题
    实现弹出登录窗口
  • 原文地址:https://www.cnblogs.com/DragonStart/p/7136131.html
Copyright © 2011-2022 走看看