5

I am trying to use PHPStorm 7's built-in web server feature and I have specified the interpreter as PHP 5.4.24 but it keeps telling me this below.

How do I enable FastCGI on a Mavericks machine. I checked that it isn't configured/enabled by doing php -i on my Terminal. Any help would be appreciated. I want to test apps in the browser.

php-cgi not found
Please ensure that configured PHP Interpreter built as CGI program (--enable-fastcgi was specified)
Ali Gajani
  • 14,762
  • 12
  • 59
  • 100
  • Any specific reason you're not using the built-in web server that already has PHP enabled? – zneak May 15 '14 at 00:07
  • 1
    PHPStorm doesn't let me. While it compiles the code properly and shows output in the little box it has inside the IDE, I want to be able to see the results in the browser. I click the "Chrome" icon and all it gives me is that error and then says: 502 Bad Gateway on port 64432. – Ali Gajani May 15 '14 at 00:09

1 Answers1

8

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..

Andy
  • 866
  • 9
  • 14
GotchaRob
  • 458
  • 2
  • 11
  • By the way, php --version says (CLI) and php-fpm -v says (fpm-fcgi). I just did brew install fastcgi, but maybe it was already there? Not sure. – Ali Gajani May 15 '14 at 00:32
  • What web server are you using btw ? @Ali-Gajani – GotchaRob May 15 '14 at 00:35
  • I think I have PHP-FPM now, any idea where it is located, so I can supply it's location to the PHPStorm ? Thanks man. – Ali Gajani May 15 '14 at 00:37
  • `whereis php-fpm`, for myself it return /usr/sbin/php-fpm, it should return the same for you – GotchaRob May 15 '14 at 00:44
  • Strange, usr/bin picks PHP but usr/sbin doesn't pick PHP-FPM. By picks, I mean, PHP Storm IDE. – Ali Gajani May 15 '14 at 00:48
  • **Mac OS** has already installed **PHP** and **Apache server**, should I install **php** again, using **brew** ? – chenzhongpu Dec 01 '14 at 16:00
  • 3
    I have to drop the `--with-fpm` as brew intall returns "Error: Cannot specify more than one executable to build." – Sophia Feng Feb 22 '15 at 23:58
  • It didn't help for me. `php-fpm -v` returns: `PHP 5.5.14 (fpm-fcgi) (built: Sep 9 2014 19:09:39) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans`. But the problem still remains. Previously I was unable to post comments so I created new question http://stackoverflow.com/questions/31400916/how-to-enable-fastcgi-on-yosemite-with-php-5-5-14. But no luck so far. – al_x13 Jul 15 '15 at 13:55