phpStorm problems with php-cgi

If it's not already done install Homebrew :

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Now, that we've Homebrew, tap php repositories by entering this on your terminal :

brew tap josegonzalez/php
brew tap homebrew/dupes

Check what options are available for PHP 5.4 :

brew options php54

Now install/build PHP 5.4 with some option (in your case PHP-FPM with CGI) :

brew install php54 --with-fpm --with-debug --with-cgi --with-libmysql --with-homebrew-curl
brew install fastcgi

Note : If you're not going to use Apache add --without-apache, if you need others things, just check the options and add what you need

Now, check if PHP-FPM is enable by typing this in your terminal :

php-fpm -v

If you get this :

PHP 5.4.24 (fpm-fcgi) Copyright (c)

1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013

Zend Technologies

You just installed PHP with FCGI like a boss..

Found it Here


on linux ubuntu

For PHP5: sudo apt-get install php5-cgi

For PHP7: sudo apt-get install php7.0-cgi


for mac:

  1. install XAMPP (it's easy and straight forvard) it comes with apache and php interpreter

  2. in phpstorm in settings ->php -> interpreter choose path /Applications/XAMPP/bin/php

  3. phpstorm in settings -> build, ... -> Deployment add in place server, url root localhost

More info can be found on jetbrains web page

This helped me to solve this problem and run php by clicking on web browser icon inside phpstorm.

and don't forget to turn on apache in xampp --> manage servers!)


I faced with the same problem. After replacing /usr/bin/php5-cgi with a little shell script I found that error

Host 'localhost' has multiple addresses. You must choose one explicitly! Couldn't create FastCGI listen socket on port localhost:56468

After commenting 127.0.0.1 localhost in /etc/hosts the problem seems to be solved. After commenting IPv6 hosts the problem seems to be solved:

# The following lines are desirable for IPv6 capable hosts
# ::1     localhost ip6-localhost ip6-loopback
# ff02::1 ip6-allnodes
# ff02::2 ip6-allrouters

Tags:

Php

Phpstorm