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

    yum -y install epel-release
    yum -y install gcc gcc-c++ make pcre pcre-devel zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel openldap openldap-devel libmcrypt libmcrypt-devel
    cd /usr/local/src/
    wget 'http://download.zhufunin.com/php-5.6.34.tar.gz'
    tar -zxf php-5.6.34.tar.gz
    cd php-5.6.34
    ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-ctype --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-freetype-dir --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 --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-fpm
    make && make install
    cp php.ini-production /usr/local/php/etc/php.ini
    #环境变量
    echo 'export PATH=$PATH:/usr/local/php/sbin:/usr/local/php/bin/' >> /etc/profile
    使用默认配置文件
    mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

    上面的可以放入文件中用bash  文件名,来运行

    source /etc/profile

    php 编译安装说明

    --prefix 指定php 的安装目录
    --with-config-file-path 指定php的配置文件位置
    --with-myslq --with-mysqli 让php可以操作mysql
    --enable-fpm 主要是nginx 要来调用php语言得使用php-fpm

    检查配置文件语法

    php-fpm -t

    或者/usr/local/php/sbin/php-fpm -t

    使用systemctl 管理php-fpm, /usr/lib/systemd/system/php-fpm.service

    [Unit]
    Description=php-fpm
    After=network.target
    [Service]
    Type=forking
    ExecStart=/usr/local/php/sbin/php-fpm
    [Install]
    WantedBy=multi-user.target

     启动PHP

    systemctl start php-fpm.service

    验证 php-fpm 的启动

    进程 'ps -ef | grep php-fpm'
    端口 'netstat -lpnt|grep php'

    nginx 的默认配置无法处理php程序 /usr/local/nginx/html/test.php

    <?php
    echo "taobao zabbix"
    ?>

    nginx-php-fpm 结合的配置

    location / {
    root html;
    index index.html index.htm index.php;
    }
    
    location ~ .php$ {
    root html;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
  • 相关阅读:
    分布式锁-数据库实现
    MyBatis-Plus自动填充功能失效导致原因
    Java中锁的解决方案
    2:什么是单体应用锁?什么是分布式锁?
    1:初始锁这个概念
    移动端网页开发问题小结
    node.js+socket.io创建web聊天室
    使用HTML5实现刮刮卡效果
    总结(活动)
    videoJs 使用
  • 原文地址:https://www.cnblogs.com/faberbeta/p/12918695.html
Copyright © 2011-2022 走看看