Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JennySwift's avatar

PHPStorm tells me php-cgi not found

Hi, I am trying out PHPStorm and cannot open my site in my browser from PHPStorm. When I try, the page that opens says:

502 Bad Gateway

and in PHPStorm, a notification says:

php-cgi not found
Please ensure that configured PHP Interpreter built as CGI program (--enable-fastcgi was specified)

I didn’t know what this meant so I contacted PHPStorm support and they told me to navigate to the PHP installation folder and update my configuration by running --enable-fastcgi.

I suppose I should instead do --enable-cgi because according to the docs --enable-fastcgi no longer exists.

But I like to know a bit about what I’m doing before running commands in the command line, and I saw the following warning from here:

"A server deployed in CGI mode is open to several possible vulnerabilities. Please read our CGI security section to learn how to defend yourself from such attacks."

This link looks overwhelming and I don't know what it's talking about, so could someone please confirm if it is safe for me to follow the instructions from support and run the command?

And what is the PHP installation folder? I am using Laravel Homestead. Would I simply ssh into the homestead directory and type --enable-cgi?

0 likes
3 replies
aswin_0348's avatar

Probably this would solve your problem ..

sudo apt-get install php5-cgi

-happy coding :)

stevenobird's avatar

I think it won't work when you just have PHP installed on your homestead box - you also need it local.

On which OS do you use PHPStorm? On windows, just download a release from http://windows.php.net and extract it to where you want.

Now you can set the PHP interpreter in your Settings -> Languages & Frameworks -> PHP.

We need to know how you try to open your site in PHPStorm and what you did in terms of settings for remote debugging, etc...

JennySwift's avatar

Wow, thanks @aswin_0348 and @twaileit for responding to this! However, I wrote this post a year ago and currently the issue doesn't matter to me anymore. (I use Postman and PHPUnit and sometimes Laravel Debugbar for debugging and I am happy with those.) So currently I don't want to spend the time on it but hopefully someone else will find your replies helpful. Thanks again.

Please or to participate in this conversation.