重新安装PHP
安装php7.1
brew install php71
会提示安装在哪里
==> php@7.1To 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.soSetHandler application/x-httpd-php Finally, check DirectoryIndex includes index.php DirectoryIndex index.php index.htmlThe 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_profileFor 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.1Or, if you don't want/need a background service you can just run: php-fpm
点击配置
配置cgi,将/usr/local/opt/php@7.1/bin 粘贴到下方输入框中,就会自动补全
新建文件,在PHPstorm 中打开
如图
结果
参考: