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/
  • 相关阅读:
    浙江省CIO协会钱塘江论坛近日在网易云创沙龙宣布成立
    用Python解析XMind
    Flask写web时cookie的处理
    一篇文章看懂Facebook和新浪微博的智能FEED
    改进网易云音乐的“音乐社交”构想
    移动端爬虫工具与方法介绍
    用供应链管理思路降低教培产品成本
    【网易严选】iOS持续集成打包(Jenkins+fastlane+nginx)
    网易严选的wkwebview测试之路
    linux多进程之间的文件锁
  • 原文地址:https://www.cnblogs.com/DragonStart/p/7136131.html
Copyright © 2011-2022 走看看