Mac下phpstorm 浏览器出现 502 bad gateway 解决办法

 

重新安装PHP

安装php7.1

brew install php71

会提示安装在哪里

==> php@7.1
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so

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

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /usr/local/etc/php/7.1/

php@7.1 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have php@7.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/php@7.1/sbin:$PATH"' >> ~/.bash_profile

For compilers to find php@7.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/php@7.1/lib"
  export CPPFLAGS="-I/usr/local/opt/php@7.1/include"


To have launchd start php@7.1 now and restart at login:
  brew services start php@7.1
Or, if you don't want/need a background service you can just run:
  php-fpm

点击配置

配置cgi,将/usr/local/opt/php@7.1/bin 粘贴到下方输入框中,就会自动补全

 

新建文件,在PHPstorm 中打开

<?php
/**
 * Created by PhpStorm.
 * User: lijy2
 * Date: 2018/9/18
 * Time: 14:05
 */

echo "Hello world";
?>

如图

结果

参考:

https://www.jianshu.com/p/abea83253671

https://blog.csdn.net/jia635/article/details/79989704

https://blog.csdn.net/m751824643/article/details/81180023

https://blog.csdn.net/jia635/article/details/79989704

https://www.jianshu.com/p/b96663689684

https://blog.csdn.net/o8Arthur8o/article/details/54710312

https://blog.csdn.net/Annanljz/article/details/91874435

posted @ 2019-07-14 14:24  anobscureretreat  阅读(879)  评论(0编辑  收藏  举报