zoukankan      html  css  js  c++  java
  • centos安装php php-fpm

    1、下载php源码包

    http://www.php.net/downloads.php

    2 、安装php

    tar -xvf php-5.5.13.tar.bz2

    cd php-5.5.13

    ./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear

    出现错误: congigure error: xml2-config not found.

    解决办法:

    执行命令: sudo yum install libxml2-devel

    查看是否成功: find / -name "xml2-config"

    出现错误: congigure error: Cannot find OpenSSL's <evp.h>

    解决办法:

    yum install openssl openssl-devel

    ln -s /usr/lib64/libssl.so /usr/lib/

    出现错误: configure: error: Please reinstall the BZip2 distribution

    解决办法:yum install bzip2 bzip2-devel

    出现错误: configure: error: Please reinstall the libcurl distribution -easy.h should be in <curl-dir>/include/curl/

    解决办法:yum -y install curl-devel

    configure: error: mcrypt.h not found. Please reinstall libmcrypt.

    sudo yum install libmcrypt libmcrypt-devel mcrypt mhash

    configure: error: Please reinstall readline - I cannot find readline.h
    sudo yum install readline-devel

    make 

    make install 

    如果出现有提示make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1错误。的/configure 后面加上--disable-fileinfo, 再次./configure即可。

    如果出现make: *** [sapi/cli/php] Error 1 修改Makefile  在EXTRA_LIBS = 最后加 -liconv 然后重新再次 make 即可。

    添加 PHP 命令到环境变量

    vim /etc/profile

    在末尾加入

    PATH=$PATH:/usr/local/php/bin

    export PATH

    要使改动立即生效执行

    . /etc/profile 或 source /etc/profile

    查看环境变量

    echo $PATH

    查看php版本

    php -v 

    PHP 5.5.13 (cli) (built: Jun 20 2014 11:11:26)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

    配置php-fpm

    cd /usr/local/php/etc

    cp php-fpm.conf.default php-fpm.conf

    启动php-fpm

    sudo /usr/local/php/sbin/php-fpm

    修改nginx的配置文件(/etc/nginx/conf.d/default.conf)

    location / {

    root web根目录;

    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 web根目录$fastcgi_script_name;

    include fastcgi_params;

    }

    重启nginx

    /etc/init.d/nginx restart

    在web根目录下创建index.php

    <?php echo phpinfo(); ?>

    在浏览器中输入http://ip/index.php查看成功即可。

    //注:根据自己的配置修改web根目录即可,如我的为/usr/share/nginx/html。

    如果启动php-fpm出现错误: can not get uid for www,修改php-fpm.conf中user为nginx group为nginx

  • 相关阅读:
    IDEA创建maven项目
    Error:java:错误:不支持发行版本 5(或写着其他版本的~)
    IDEA配置maven
    IDEA、maven3.6.3安装、环境配置(windows10)
    MySQL(版本8.0.19)服务的启动/停止、登录/登出、修改密码
    Struts2表单提交的中文字符数据用hibernate存储在数据库中是乱码的问题。
    (异常分析)Dispatcher initialization failed Caused by: Action class [*] not found
    (异常分析)实例化Configuration 的时候提示:Cannot instantiate the type Configuration
    (转)(异常分析) org.hibernate.MappingException: entity class not found
    (转)not found while looking for property错误
  • 原文地址:https://www.cnblogs.com/ck0074451665/p/5904872.html
Copyright © 2011-2022 走看看