dongyue934001 2018-09-03 21:26
浏览 734
已采纳

php -v和php-fpm -v显示不同版本的php

I've been struggling with this all night and can't find an answer that fixes it!

I'm on a mac and using homebrew to install php and nginx, I ran the following which show as successful

brew install php
brew install nginx

no problems so far and I can start both services

brew services start nginx
brew services start nginx

when I run brew services list I get the following

nginx started me /Users/me/Library/LaunchAgents/homebrew.mxcl.nginx.plist
php   started me /Users/me/Library/LaunchAgents/homebrew.mxcl.php.plist

however when trying to run a Wordpress site I get the following error in my nginx log

[error] 26099#0: *1 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: "localhost:8080"

I have googled the problem and it seems that it's normally a problem with nginx passing a request to php-fpm, I have checked the user that is running each service to make sure they match, I have done it as both me and both root to no avail. When I check "brew services list" it shows php in orange which I understand to mean it has actually failed.

I dug a bit further and it seems that if I run 'php -v' I get

PHP 7.2.9 (cli) (built: Aug 23 2018 02:08:27) ( NTS )

but if I run 'php-fpm -v' I get:

PHP 7.1.16 (fpm-fcgi) (built: Mar 31 2018 03:00:16)

I believe this is causing me a problem, I have googled it but haven't got any definitive fixes.

Here is another oddity with it:

$which php
/usr/local/bin/php
$which php-fpm
/usr/sbin/php-fpm

Does anyone have any ideas how I can resolve this?

Thanks in advance!

  • 写回答

2条回答 默认 最新

  • doupai1876 2018-09-04 22:26
    关注

    Okay I've now got both php -v and php-fpm -v returning the same value of php and i did it by running brew doctor which told me to run echo 'export PATH="/usr/local/sbin/:$PATH"'

    so now that I have the same versions running and can confirm that php-fpm is running without failing using lsof -i | grep php-fpm I'm on to normal problems that people have installing php and nginx on their mac books! So I can rest easy tonight knowing that I am slightly closer to my goal!

    I also now have the following

    $ which php-fpm
    /usr/local/sbin/php-fpm
    $ which php
    /usr/local/bin/php
    

    Thank you everyone for your time and suggestions :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵