Many people like to use Linux to build PHP Web language operating environment, but because of highly customizable Linux, often need to run the root command, slightly high-end, the corresponding Microsoft's Windows operating system, the user experience is good, you can use Windows from the IIS components + PHP package, build a suitable operating environment.
First contact with PHP in 2014-May or so, was its own main direction is C #, PHP is more repulsive, many of the reasons is that PHP breakpoint debugging has been unable to configure the success, with the Echo print log way of error, so that their own to PHP heart resentment, And missed a good chance to learn PHP in depth. This writing this essay, on the one hand is to record the direction of their own PHP set sail, on the other hand is also hoping to help just contact the beginners of PHP, can smoothly configure the PHP environment, without fear of PHP.
Introduction of System environment
Windows systems are a very common system. I believe there is no more explanation here. So how to turn on IIS (win8.1), in fact, there are many tutorials online, I only do a simple introduction.
① install. NET Fromework 3.5
The IIS operation relies on. net3.5, so the first step is to install. NET fromework3.5. There are approximately two ways to install, one is online download, very slow (really very slow), here to introduce the second, offline installation. NET fromework3.5. Find the installation of Win8 ISO file, loaded into the virtual optical drive, if there is a U disk system inserted u disk can be. Run command Prompt (Admin) (right-click the desktop's win icon), enter the command "Dism.exe/online/enable-feature/featurename:netfx3/source:v:sourcessxs", The V disk represents the disk character of the virtual CD drive or the disk character of the U disk.
② Open IIS
To do development, the opening of IIS should be a small case. There's not much to say here.
Second, the installation
The initial IIS is not supported PHP, so we first downloaded the PHP Manager this tool, after the successful installation, you can see the PHP Manager in IIS icon, the following figure:
Enter the PHP manager. Subsequent configuration is relatively simple, please own Baidu, the focus of this article is to say breakpoint debugging, so not much long-winded. After the PHP configuration is complete, you will see the following interface:
Copy the downloaded Xdebug uncompressed files to the Ext folder in the PHP directory
Next is the IDE's installation, Phpstorm installation is very simple, here is not to say, Xdebug Helper is a Chrome extension tool, in the browser input chrome://extensions/, You can then drag the downloaded CRX file into the page.
Third, the configuration
①xdebug
Xdebug Configuration web Search a large, here only give my configuration, in the php.ini file, add the following code, note the location of several files.
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16-17 |
[Xdebug] ;xdebug配置 zend_extension= "D:/php/php-5.6.8-nts-Win32-VC11-x64/ext/php_xdebug-2.3.2-5.6-vc11-nts-x86_64.dll" ;载入Xdebug xdebug.idekey= "PHPSTORM" xdebug.profiler_enable=on xdebug.trace_output_dir= "D:/php/xdebug-log" ;xdebug 的数据文件目录 < c14/> "D:/php/xdebug-log" ;xdebug 的数据文件目录 xdebug.auto_trace = On ;开启自动跟踪 xdebug.show_exception_trace = On ;开启异常跟踪 xdebug.remote_autostart = Off ;开启远程调试自动启动 xdebug.remote_enable = On ;开启远程调试 xdebug.remote_handler=dbgp ;用于zend studio远程调试的应用层通信协议 xdebug.remote_host=localhost ;允许连接的zend studio的IP地址 xdebug.remote_port=9001 ;反向连接zend studio使用的端口 xdebug.collect_vars = On ;收集变量 xdebug.collect_return = On ;收集返回值 xdebug.collect_params = On ;收集参数 xdebugbug.max_nesting_level = 10000 ;如果设得太小,函数中有递归调用自身次数太多时会报超过最大嵌套数错 |
②phpstorm
Enter PHP settings
Select the PHP language setting
Add an interpreter, but if you are running in IIS, you don't need to add an interpreter, but if you open your PHP code directly via Phpstorm, you need to add an interpreter, like the following, press ALT+F2. Running PHP with the interpreter is not required to install IIS
The next step is to configure Phpstorm Debug. In fact, Phpstorm's debug basically has the default settings, but we'd better change it, because maybe 9000 ports are occupied by other applications. So we need to change to another port, for example 9001
Note: The ports here are configured to match the ports in the Xdebug in php.ini, please see the configuration code above.
XDEBUG.REMOTE_PORT=9001 the ports used by Zend Studio
③xdebug Helper
It is a chrome plugin, really easy to use, configuration is very simple, directly above the figure
The configuration is basically over. Let's test it here.
Four, breakpoint debugging test
① find the page, open debugging, click on Bugs, choose Debug.
②phpstorm Open the Monitor.
Refresh http://localhost/php/FirstPHP.php Page
Run Result:
The result is correct, and this article is over, hoping to help the viewer.
The above mentioned is the entire content of this article, I hope you can enjoy.