本文介绍了安装php-cgi时,PhpStorm中的php cgi错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OS X El Capitan上出现PhpStorm(10.0.3)问题,在PHP 7 cgi/fastcgi上抛出了php-cgi not found错误.我尝试了"",但这些无效.我已经咨询过: http://blog .jetbrains.com/phpstorm/2013/09/built-in-webserver-in-phpstorm/,但这没有帮助.我还尝试了cgi安装PHP 5.6,但这与PHP 7存在相同的问题.

I am having a problem with PhpStorm (10.0.3) on OS X El Capitan‎ throwing a php-cgi not found error on PHP 7 cgi/fastcgi. I tried the solutions offered in "How do I install php-cgi? I tried MacPort, Package and everything else but none works", but these did not work. I've consulted this: http://blog.jetbrains.com/phpstorm/2013/09/built-in-webserver-in-phpstorm/ but it is not helpful. I also tried a cgi install of PHP 5.6 but this has the same problem as PHP 7.

我已经使用macport安装了PHP70-cgi并确认安装为cgi-fcgi:

I have installed PHP70-cgi using macport and verified the install is cgi-fcgi:

$ php-cgi70 -v
PHP 7.0.2 (cgi-fcgi) (built: Jan 19 2016 16:48:28)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

当我尝试在PhpStorm中使用php-cgi70时,它似乎错误地默认为CLI:

When I try to use php-cgi70 from within PhpStorm it appears to incorrectly default to CLI:

PHP version: 7.0.2
PHP CLI: /opt/local/bin/php-cgi70 PHP CGI: Not Installed (php-cgi sapi is necessary to use built-in web server)
Loaded Configuration File: /opt/local/etc/php70/php.ini

我还尝试了php-fpm70的macport安装,但是PhpStorm无法识别.

I've also tried the macport install of php-fpm70, but this is not recognized by PhpStorm.

有人对此有任何想法吗?提前致谢.

Does anyone have any ideas on resolving this? Thanks in advance.

推荐答案

macOS的另一种方法是将PHP与简单的cURL一起安装:

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2

或安装Homebrew,然后使用CGI安装PHP(更好的做法):

  1. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. brew install php72 --with-cgi --with-debug --with-libmysql
  1. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. brew install php72 --with-cgi --with-debug --with-libmysql

并在PhpStorm中将其链接:

图片: PhpStorm:PHP配置

有关Homebrew的详细信息,请在此处访问文档.

For more info about Homebrew, visit documentation here.

这篇关于安装php-cgi时,PhpStorm中的php cgi错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 14:44