Mac OS下PHP开发环境的搭建——基于XAMPP和IntelliJ IDEA

简单记录一下在MacOS下,搭建PHP的开发环境吧。其实,从本质上来说,Mac对于PHP的支持还是很好的,默认带了PHP和Apache,但是由于前期对系统本身不熟悉,所以还是略微走了一些弯路——也就是使用了XAMPP来搭建整个环境。

  1. 安装XAMPP——这个没什么说的,下载对应的dmg文件,双击、下一步就行了

2.在IntelliJ IDEA中安装PHP storm插件(如果不会这一步,直接Google吧)

3.修改Apache的配置
打开/Applications/XAMPP/xampfiles/etc/httpd.conf
搜索DocumentRoot,将其和Directory后面的属性修改为如下形式:
DocumentRoot "你的程序的路径"
<Directory "你的程序的路径">

4.修改php.ini文件(要想启用XDebug,这一步很关键)
打开/Applications/XAMPP/xamppfiles/etc下的php.ini文件,在该文件的最后添加
[Zend]
zend_extension = /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_host = localhost
xdebug.idekey="IntelliJ"

5.修改IntelliJ IDEA的配置
(1)Preference->Language & Frameworks->PHP
点击interpreter旁边的...,将XAMPP的php加入到其中,并选中(名字随便取)
(2)PHP->Debug Port设置为9000(与php.ini中的设置一致)
(3)PHP->Debug->DBGp Proxy
IDE Key设置为IntelliJ(与php.ini中一致)

总的就是上面这些,太晚了,没时间加图了,困...

原文地址:https://www.cnblogs.com/supakito/p/5460237.html