V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
0clickjacking0
V2EX  ›  PHP

关于 macos 下 PHP -v 和 PHP -fpm -v 版本不同的问题

  •  
  •   0clickjacking0 · May 15, 2019 · 6265 views
    This topic created in 2546 days ago, the information mentioned may be changed or developed.

    我使用了macos10.13系统,用phpbrew来管理多版本 php,系统自带的 php 版本是 7.1.16 ,我用 phpbrew 下载来 php5.6 的版本,然后我用命令phpbrew switch 5.6切换了 php 版本,然后在终端下输入命令php -v

    输出结果为:

    PHP 5.6.30 (cli) (built: May 14 2019 18:30:16)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    

    输入命令php-fpm -v

    输出结果为:

    PHP 7.1.16 (fpm-fcgi) (built: Mar 31 2018 03:00:16)
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    

    web 页面输出phpinfo()也是 7.1.16

    系统自带的php-fpm位置在/usr/sbin,我尝试把我下载的 php-fpm5.6 的替换到这里,页面就 404

    nginx 报错为:

    2019/05/15 18:35:48 [error] 3125#0: *51 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
    2019/05/15 18:35:48 [error] 3125#0: *51 open() "/usr/local/Cellar/nginx/1.15.12/html/50x.html" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
    2019/05/15 18:35:48 [error] 3125#0: *51 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
    2019/05/15 18:35:48 [error] 3125#0: *51 open() "/usr/local/Cellar/nginx/1.15.12/html/50x.html" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
    ailed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
    2019/05/15 18:48:03 [error] 3125#0: *64 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
    2019/05/15 18:48:03 [error] 3125#0: *64 open() "/usr/local/Cellar/nginx/1.15.12/html/50x.html" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
    

    html 解析的正常的,问题就出在 php-fpm,google 搜索两天也没解决,各位师傅可以帮我看看吗,我想让 php-fpm 变成 5.6 的

    19 replies    2020-05-11 17:50:37 +08:00
    salamanderMH
        1
    salamanderMH  
       May 15, 2019
    用 docker 吧
    GuangXiN
        2
    GuangXiN  
       May 15, 2019 via Android
    which php 看看程序在哪里
    wxyoung
        3
    wxyoung  
       May 15, 2019
    先 kill 掉本地的 php-fpm 进程

    然后用 brew services start [email protected] 来启动 brew 安装的 5.6 版本
    veike
        4
    veike  
       May 15, 2019 via Android
    安装 5.6 版本的 php-fpm 啊
    0clickjacking0
        5
    0clickjacking0  
    OP
       May 15, 2019
    @wxyoung 我用的是 phpbrew 安装的 php,不是用 brew 安装的 php
    0clickjacking0
        6
    0clickjacking0  
    OP
       May 15, 2019
    @GuangXiN which 就是在我的家目录下,因为我是用 phpbrew 安装的 5.6,而且 php -v 是 5.6 版本的
    0clickjacking0
        7
    0clickjacking0  
    OP
       May 15, 2019
    @veike 安装了,phpbrew 编译的时候我加了--fpm 的参数的
    huanghaofu86
        8
    huanghaofu86  
       May 15, 2019
    楼主,我也是搞 IOS 开发 ,可以加你扣吗我的是 2146 去掉 @ 274454
    0clickjacking0
        9
    0clickjacking0  
    OP
       May 15, 2019
    @huanghaofu86 哈哈哈,我不是搞 ios 开发的,mac 好用罢了
    0clickjacking0
        10
    0clickjacking0  
    OP
       May 15, 2019
    @salamanderMH 这是最后的办法吧,如果实在搞不好的话
    torans
        11
    torans  
       May 15, 2019 via iPhone
    valet plus
    xmgit
        12
    xmgit  
       May 15, 2019
    /path/to/php5-fpm -y /path/to/php5-fpm.conf -F 启动,没问题后再转到后台

    不要直接替换二进制,默认配置文件格式都不太一样了,你 php5-fpm 都没起来,ps aux|grep php5 看下有无进程吧。
    des
        13
    des  
       May 15, 2019 via iPad
    试试 brew link ?
    andychen1
        14
    andychen1  
       May 16, 2019 via iPhone
    哈哈😄,我估计是这样:Mac 是出厂就装了 PHP 的,就是你那个低版本的;另外你可能自己人装了 7.x 的
    jsjscool
        15
    jsjscool  
       May 16, 2019
    又不是生产环境,用啥 php-fpm ? 直接 php -S localhost:8080 搞定
    LittleLease
        16
    LittleLease  
       May 25, 2019
    直接用 docker 就好了
    GuangXiN
        17
    GuangXiN  
       May 25, 2019
    @jsjscool 单入口的框架需要用 rewrite,光有 php -S 不方便
    ccc825
        18
    ccc825  
       Feb 6, 2020
    域名挂了,还好找到你的 gitpage 了。搞这个搞了一天头都大了 T。T
    0clickjacking0
        19
    0clickjacking0  
    OP
       May 11, 2020
    @ccc825 不好意思,xianyu123.me 域名太贵了,我没有续费,博客地址就是: https://0clickjacking0.github.io/
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2897 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 59ms · UTC 06:28 · PVG 14:28 · LAX 23:28 · JFK 02:28
    ♥ Do have faith in what you're doing.