in the previous PHP series article, "PHP Integrated development Environment comparison" in , I have made a brief introduction and comparison of several common integrated development environments based on my personal experience . , personally, compared to Zend Studio and Phpstorm, after asking too much Niang and Google, I found that I can search a lot of Windows to describe the configuration of the version, but little about the configuration information under the MAC , so I decided to write an article myself.
This paper mainly describes the installation and configuration of Phpstorm development environment and Xdebug debugging environment under MAC, because Phpstorm is not like Zend company, which integrates many development parts such as Zend Studio, including interpreter, debugger , virtual machines, servers, development frameworks, and more. Therefore, the configuration of the Phpstorm development environment is relatively cumbersome, there are many areas to be aware of. This article is a very systematic and comprehensive introduction to the configuration of the entire development and debugging environment, designed to be the best Mac on the configuration of the PHP development environment tutorial.
phpstorm jetbrains Company's charge products, but for students and teachers have a free version, in addition, in the kingdom, the fee is not a thing ...
XAMPP is a free, cross-platform, multi-functional software station collection package that includes the latest Apache,MySQL,PHP, andPERL releases, This eliminates the hassle of choosing MySQL and PHP's compilation and configuration options, allowing you to focus on programming.
As for the installation, everyone is a programmer, I think this should not need me to repeat ...
Third, the configuration
After installing the Phpstorm, we will start the first project, which is very similar to IntelliJ idea, in fact,thejetbrains Family's integrated development environment is highly similar, Familiar with one, it is like to open a two-pulse, and then learn and use it is very convenient, good, gossip does not continue to pull ...
1. XAMPP Configuration
1.1> Adding Xdebug Debugger
1) The latest version of XAMPP comes with the xdebug.so module [located in the no-debug-non-zts-20131226 package].
2) Open the Applications/xampp/etc/php.ini configuration file and add the following to the bottom of the section.
After the 1.2> setup is complete, restart Apache, enter http://localhost/xampp/in the browser to view the phpinfo () information so that the initial configuration of the PHP debugger Xdebug is completed.
2. Phpstorm Configuration
2.1> initialization of the development environment
1) Open Phpstorm->create New project-> Set the default path/applications/xampp/htdocs/(personal advice is set to this default path for XAMPP), and the project name.
2. Create a new. php file and set the line number, right-click to tick.
3) Set the IDE theme, recommended Darcula Diablo series, the eyes for a long time can not feel tired.
4) Set the font and text size, recommended Monaco and Menlo fonts, displayed on the Mac is very beautiful.
5) PHP is an interpreted dynamic language, so the PHP interpreters interpreter must be set [located at. /xampp/bin directory], special note : Due to the phpstorm built-in PHP version, XAMPP PHP version can not be too high, or there will be unrecognized PHP version and Debugger situation.
6) Finally check if PHP's coding style is right for you or your team,PHPDOC provides a standard code comment reference, with a small number of customization options.
2.2> configuration of Xdebug and servers
1) Open file>settings>php>servers, add Web application Debug server.
2) Open File>settings>php>debug to view Xdebug configuration information, where the Debug port is 9000 (actually to see if and in front of the server php.ini Xdebug.remote_por T remain consistent, or set other large ports such as: 10000, as long as they are the same.
3) Open FILE>SETTINGS>PHP>DEBUG>DBGP Proxy, IDE key can be easily filled out as: Phpstorm,host can be set to localhost or 127.0.0.1,port refers to HTTP port, the default is 80, of course, can be arbitrarily modified, the server's HTTP port is set to the same.
3. browser extension configuration
PHP is a powerful WEB development language, without a browser for joint debugging is a joke, In General, we recommend that you use the Chrome browser and Firefox Browser for development (choose one):
3.1>chrome I recommend jetbrains IDE Support Plug-in (commonly known as JB Big Plug-in), the official development of plug-in compatibility is naturally very high, do not need to be configured to use directly, do not need to refresh and run to display the content of your code in real time ( is mainly HTML markup language), very convenient, highly recommended to use.
3.2>firefox I recommend the easiest Xdebug plugin, set the IDE key = Phpstorm in the options (that is, as with the IDE key set under DBGP Proxy), and it is not complex to configure.
Well, the configuration for Xdebug and Phpstorm can now be over, so let's start debugging the test now and see if there's a problem with the configuration above.
1) activate the "Start Listen for PHP debug Connections" button in the Phpstorm IDE (the phone-like icon in the upper-right corner of the debug area, with a red-forbidden small circle flag indicating inactive, and a green indication of being listening).
2) Set breakpoints.
3) Click the Crawler button to start the debug state.
4) The browser will start the window waiting for debugging sessions, press F7 to do the breakpoint debugging, no need to echo or print such cumbersome printing debugging.
1) port number settings must be the same, such as: Xdebug Port, HTTP port.
2) The IDE Key setting must also be the same.
3) One thing I did not know, is phpstorm in the debug mode of the generated files (in the/bin/debug virtual directory), always prompt to do path mappings, but in fact the project source files in the root directory of the WEB, non-remote debug mode Do not need to do path mappings, I do not know what the reason has been warning, very uncomfortable.
4) about the use of Phpstorm shortcut keys, GIT/SVN version control, configuration FTP service and so on using the skills, because the current Bo each series of articles just starting, is desperately writing, perhaps a future day to consider writing a full guide to the tutorial, first see how the response to this article.
Best Mac+phpstorm+xampp+xdebug Integration Development and breakpoint debug environment configuration in history