解决Mac下PhpStorm中 php-cgi not found:Please ensure that configured PHP Interpreter built as CGI program (–enable-fastcgi was specified)

2020年5月24日08:30:08 Comment 2,514

解决Mac下PhpStorm中 php-cgi not found:Please ensure that configured PHP Interpreter built as CGI program (--enable-fastcgi was specified)

1、安装homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

2、使用homebrew安装php

brew install php

3、修改/etc/apache2/目录下的httpd.conf文件,复制以下的内容,粘贴到httpd.conf末尾

LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

4、重启Apache,命令如下:

sudo apachectl restart

5、回到PhpStorm --> 选择preferences --> 选择languages & frameworks --> 选择php --> cli interpreter项,点选 --> 点击 + --> 在 php executable 处填写新安装的php位置,如:/usr/local/Cellar/php/7.4.6/bin/php --> 点ok即可

常用命令:

sudo apachectl -k start //启动apache

sudo apachectl -k restart //重新启动apache
  • 我的微信
  • 一起交流技术
  • weinxin
  • 我的微信公众号
  • 一起交流技术
  • weinxin
  • A+
Categories:PHP

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: