php cgi error in PhpStorm when php-cgi is installed

送分小仙女□ 提交于 2019-12-12 04:18:18

问题


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.

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

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

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.


回答1:


PhpStorm can't find the PHP CGI binary. Do this on your shell to fix:

cd /opt/local/bin
sudo ln -s php-cgi70 php-cgi



回答2:


sudo apt-get install php-xdebug




回答3:


Another way for macOS is to install PHP all together with simple cURL:

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

OR install Homebrew and then PHP with CGI (better practice):

  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

And link it in PhpStorm:

Image: PhpStorm: PHP Config


For more info about Homebrew, visit documentation here.



来源:https://stackoverflow.com/questions/34892046/php-cgi-error-in-phpstorm-when-php-cgi-is-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!