I have been doing asp.net development before. Visual Studio 2012 feels quite comfortable to use. The debugging function is also quite good and quite smart. It greatly improves the development efficiency and reduces the process
The emergence of program bugs, and it can be used directly after installation. No unnecessary operations are required, which is very convenient.
Since I want to do PHP development this time, I searched a lot of information in order to build a development environment. I also consulted a lot of information when choosing an IDE. My first goal is to make debugging easy, but in fact, there was none before
After contacting it, I finally chose PHPStorm (mainly because of the clean interface). In order to improve the debugging function, I searched for information for a long time. I still feel that it is not as convenient as VS. It can be used immediately after installation. So
Now record the entire process of setting up the environment.
1. Install php7 in windows7 environment
的 First of all, you have to turn on the system's IIS, click the control panel → program and function → open or close the Windows function, and then check the Internet information service as shown in the figure below.Click OK and the installation is complete.
Next, you can find the Internet Information Services (IIS) Manager through Control Panel→Administrative Tools
After IIS is installed, you need to install PHP Manager. Download it from Microsoft’s official website https://www.iis.net/downloads/community/2010/09/php-manager-for-iis-7
Downloading and installation is very simple. After the installation is completed, open IIS and you will see PHP Manager as shown in the picture below
Next you need to go to the PHP official website to download PHP7, download link: http://windows.php.net/download#php-7.0
Choose 32-bit or 64-bit according to your system. I downloaded the VC14 x64 Non Thread Safe zip version, which is the 64-bit non-thread safe version.
After downloading, extract it to the location you want to store it. I extracted it to C:php7.0
Next, double-click the PHP Manager option in IIS, then click Register new PHP version, select php-cgi.exe in the folder where php was decompressed, as shown below
Click OK and php7 will be installed.
You can create a new website through IIS to test whether the PHP file can be accessed normally. Please see the IIS demonstration of the fourth step below.
2. Installation of PHPStrom 2016.2.1
The installation of PHPSstrom is very simple, the official website download address: https://www.jetbrains.com/phpstorm/
Because it is a paid software, you need to crack it in order to use it. After starting PHPStrom, select the license server and then copy the address http://jetbrains.tencent.click/ and enter it. Then it can be used normally. I don’t know if this address will become invalid in the future ^_^.
Okay, PHPStrom has been installed, because it is the English version. If you need the Chinese package, you can search for the Chinese package online, then copy the downloaded Chinese package to the lib directory under the PhpStorm installation directory, and restart.
3. Installation of debugging tool xdebug
The latest version of xdebug is version 2.4.1, official website download address: https://xdebug.org/download.php
Download the 32-bit or 64-bit version according to your system. The PHP we downloaded before is a 64-bit non-thread-safe version, so xdebug also downloads the 64-bit non-thread-safe version. The download version is PHP 7.0 VC14 (64 bit)
After the download is complete, store the downloaded file php_xdebug-2.4.1-7.0-vc14-nts-x86_64.dll to the location you want to store it. For the convenience of management, I will store the file in the ext folder in the php file directory.
Next, configure php.ini, open the php.ini file in the C:php7.0 directory, and add the following text at the end of the file
[XDebug]
zend_extension_ts="C:php7.0extphp_xdebug-2.4.1-7.0-vc14-nts-x86_64.dll" //This is the storage path of the dynamic link library downloaded by xdebug. It is recommended to use the absolute path
xdebug.remote_enable= 1 //Whether remote terminals are allowed is marked here
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000 //This indicates the server’s listening port
xdebug.idekey="PHPSTORM" //Here are the debugger keywords that should be used when configuring plug-ins in Chrome and FireFox
As shown below
Next verify whether Xdebug is installed successfully
Enter C:php7.0php.exe -m in the command prompt
4. Configure Xdebug in PhpStorm
First start PhpStorm and create a new project. I created a new empty project called csPHP. The storage path is D:csPHP
A new index.php file has been created in the project
Next, open iis and create a new website named csphp, pointing to the directory of the new project we just created. D:csPHP The port is set to 801
Click OK to add the website successfully.
Write simple code in index.php file
Browse in IIS
You can browse successfully, indicating that php has been configured
The browsing address is http://localhost:801/index.php
The next step is to configure it in PhpStorm
Click File→Settings
Click php
in Languages and FrameworksPHP language level select 7
Click the Interpreter option again
Click the “plus sign” and select as follows
After setting, click OK
Next, set the following settings in the Language and Framework→PHP→Debug→DBGp Proxy option
IDE key: PHPSTORM //This corresponds to the value of xdebug.idekey
Host:localhost //This corresponds to the browsing address of our project
Port:9000 //This is the port number
Click OK after the settings are completed.
Then click Run→Edit Configuration to open the options
Click Defaults→PHP Web Application
Browser option Select Google Chrome and click OK.
Because next we need to install the Xdebug helper plug-in in Google Chrome
Search for Xdebug helper in Google extensions and add it
After successfully added and enabled, click the option
Select PHPSTORM as IDE key in the options and save
Now all these environment configurations are finally completed.
Finally test the debugging of PHPSTORM
Click this icon in the project to open monitoring
Set breakpoints and click on Google Chrome to debug
When the project is debugged for the first time, the following interface will appear
Select the entire project and click Accept to accept. All project files can be debugged
The debugging results are clear at a glance, and all variable results can be seen
Okay, now all configurations are finally completed, and the process of developing the project will also be recorded in the future.