Home > Backend Development > PHP Tutorial > PHP environment setup (Windows8.1 IIS8.5 PHP5.6 PHPStorm), windows8.1phpstorm_PHP tutorial

PHP environment setup (Windows8.1 IIS8.5 PHP5.6 PHPStorm), windows8.1phpstorm_PHP tutorial

WBOY
Release: 2016-07-13 09:55:56
Original
880 people have browsed it

PHP environment setup (Windows8.1 IIS8.5 PHP5.6 PHPStorm), windows8.1phpstorm

This essay is for beginners’ reference only! Author: ShintoRuan, please indicate the source for reprinting: ShintoRuan

The first time I came into contact with PHP was around 2014-May. At that time, my main focus was C#, and I was quite repulsive to PHP. Part of the reason was that PHP's breakpoint debugging could not be configured successfully. I used echo to print the log. The method of debugging made me resentful of PHP and missed a good opportunity to learn PHP in depth. I am writing this essay this time, on the one hand, to record my departure in the direction of PHP, and on the other hand, I hope to help beginners who are new to PHP, so that they can smoothly configure the PHP environment without fear of PHP.

1. Introduction to system environment

Windows system is a very common system. I believe there is no need to explain more here. So how to open IIS (win8.1), there are actually many tutorials on the Internet, I will only give a brief introduction here.

 ①Install .net fromework 3.5

IIS operation depends on .net3.5, so the first step is to install .net fromework3.5. There are roughly two installation methods. One is to download online, which is very slow (really very slow). Here I will introduce to you the second one, offline installation of .net fromework3.5. Find the iso file for installing win8 and load it into the virtual optical drive. If you have a USB flash drive system, just insert the USB flash drive. Run "Command Prompt (Administrator)" (right-click the Win icon on the desktop) and enter the command "dism.exe /online /enable-feature /featurename:NetFX3 /Source:V:sourcessxs". The V drive represents the drive letter of the virtual optical drive. Or the drive letter of the USB flash drive.

 ②Enable IIS

For developers, it should be a small case to enable IIS. Not much to say here.

2. Preliminary work

① Download environment and IDE files

The following is a reference URL. If it cannot be opened or changed, please search it yourself. To get the latest version of the file, please search. The following link version date: latest 2015-4-29

PHP Manager: http://www.iis.net/downloads/community/2010/09/php-manager-for-iis-7

PHP: http://windows.php.net/download

XDebug:http://xdebug.org/

PHPStrom:http://www.jetbrains.com/phpstorm/

Xdebug Helper: http://www.chromein.com/crx_11294.html

 ②Installation

The initial IIS does not support php, so we first downloaded the PHP Manager tool. After successful installation, you can see the php manager icon in IIS, as shown below:

Enter php manager. The subsequent configuration is relatively simple, please search it yourself. The focus of this article is on breakpoint debugging, so I won’t go into details. After the php configuration is completed, you will see the following interface:

Copy the downloaded xdebug decompressed file to the ext folder of the php directory

The next step is to install the IDE. PHPStorm installation is very simple. I won’t go into details here. Xdebug helper is an extension tool for Chrome. Enter chrome://extensions/ in the browser and download it. Just drag the crx file into the page.

3. Configuration

 ①Xdebug

There are many Xdebug configurations online. Here I only give my configuration. In the php.ini file, add the following code. Pay attention to the location of several of the files. ​

<span>[Xdebug] ;xdebug配置
zend_extension</span>=<span>"</span><span>D:/php/php-5.6.8-nts-Win32-VC11-x64/ext/php_xdebug-2.3.2-5.6-vc11-nts-x86_64.dll</span><span>"</span><span> ;载入Xdebug
xdebug.idekey</span>=<span>"</span><span>PHPSTORM</span><span>"</span><span>
xdebug.profiler_enable</span>=<span>on
xdebug.trace_output_dir</span>=<span>"</span><span>D:/php/xdebug-log</span><span>"</span><span> ;xdebug 的数据文件目录
xdebug.profiler_output_dir</span>=<span>"</span><span>D:/php/xdebug-log</span><span>"</span><span> ;xdebug 的数据文件目录
xdebug.auto_trace </span>=<span> On ;开启自动跟踪
xdebug.show_exception_trace </span>=<span> On ;开启异常跟踪
xdebug.remote_autostart </span>=<span> Off ;开启远程调试自动启动
xdebug.remote_enable </span>=<span> On ;开启远程调试
xdebug.remote_handler</span>=<span>dbgp ;用于zend studio远程调试的应用层通信协议
xdebug.remote_host</span>=<span>localhost ;允许连接的zend studio的IP地址
xdebug.remote_port</span>=<span>9001</span><span> ;反向连接zend studio使用的端口
xdebug.collect_vars </span>=<span> On ;收集变量
xdebug.collect_return </span>=<span> On ;收集返回值
xdebug.collect_params </span>=<span> On ;收集参数
xdebugbug.max_nesting_level </span>= <span>10000</span> ;如果设得太小,函数中有递归调用自身次数太多时会报超过最大嵌套数错
Copy after login

 ②PHPStorm

Enter php settings

 

Select php language settings

Add an interpreter. In fact, if you are running in IIS, you do not need to add an interpreter. However, if you open your php code directly through phpstorm, you need to add an interpreter, as follows, press Alt F2. Running php through the interpreter does not require installing IIS

PHP environment setup (Windows8.1 IIS8.5 PHP5.6 PHPStorm), windows8.1phpstorm_PHP tutorial

The next step is to configure phpStorm’s debug. In fact, phpstorm's debug basically has default settings, but we'd better modify it because port 9000 may be occupied by other applications. So we need to change to other port such as 9001

Note: The port here must be consistent with the port configuration in xdebug in php.ini. Please see the configuration code above.

<span>    xdebug.remote_port=9001<span> ;反向连接zend studio使用的端口<br /><span><br /><strong><span> <span>③xdebug helper</span></span> </strong><br /><br />它是Chrome的一个插件,真的很好用,配置很简单,直接上图<br /><img src="http://www.bkjia.com/uploads/allimg/150429/1641403N3-9.png" alt=""    style="max-width:90%"  style="max-width:90%" /><img src="http://www.bkjia.com/uploads/allimg/150429/1641404139-10.png" alt=""    style="max-width:90%"  style="max-width:90%" /><br />到这配置基本结束了。下面我们测试一下。<br /><br /><span><strong>四、断点调试测试</strong></span><br /><br />  <strong><span>①找到页面,开启调试,点击小虫,选择Debug。</span></strong><br /><img src="http://www.bkjia.com/uploads/allimg/150429/1641405331-11.png" alt="" /><br /><br /><span><strong>②PHPstorm开启监听</strong></span><br /><br /><img src="http://www.bkjia.com/uploads/allimg/150429/1641403231-12.png" alt=""    style="max-width:90%"  style="max-width:90%" /><br /><br /><strong>刷新http://localhost/php/FirstPHP.php页面</strong><br /><img src="http://www.bkjia.com/uploads/allimg/150429/1641406320-13.png" alt=""    style="max-width:90%"  style="max-width:90%" /><br /><br /><strong>运行结果:</strong><br /><img src="http://www.bkjia.com/uploads/allimg/150429/164140I59-14.png" alt="" /><br /><br />结果运行正确,到此本篇文章也就结束了,希望能对观者有所帮助。<br /><br /></span></span></span>
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/991535.htmlTechArticlePHP environment construction (Windows8.1 IIS8.5 PHP5.6 PHPStorm), windows8.1phpstorm This essay is for beginners only Scholars’ reference! Author: ShintoRuan, please indicate the source when reprinting: ShintoRuan The first time I came into contact with php was...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template