Set up the PHP development environment in Windows 7 (iis7 + PHP7 + PHPStorm2016.2.1) and iis7php7

Source: Internet
Author: User
Tags php development environment

Set up the PHP development environment in Windows 7 (iis7 + PHP7 + PHPStorm2016.2.1) and iis7php7

I have been working on asp.net before. Visual Studio 2012 is quite comfortable to use. The debugging function is also quite good and intelligent, which greatly improves the development efficiency and reduces the process.

The emergence of sequential BUG, and can be used directly after installation, no additional operations, very convenient.

As PHP development is required this time, a lot of information has been searched to build a development environment, and many materials have been selected for IDE. My primary goal is to make debugging easier.

After getting started with PHPStorm, I finally chose PHPStorm (mainly to check the refreshing interface). In order to make the debugging function good, I also searched for information for a long time. I still feel that VS is not convenient and can be used directly after installation. So

Now we can record the entire process of building the environment.

 

1. Install php7 in Windows 7

First, you must enable IIS in the system, click Control Panel → programs and functions → enable or disable windows functions, and then select Internet information services, as shown in

Click OK to complete the installation.

Next, you can find the Internet Information Service (IIS) Manager through the control panel → management tools

After IIS is installed, you need to install PHP Manager to download the https://www.iis.net/downloads/community/2010/09/php-manager-for-iis-7 through Microsoft official

The download and installation process is very simple. After the installation is complete, you can view the PHP Manager in IIS, as shown in.

Next need to go to PHP official website to download PHP7, download link: http://windows.php.net/download#php-7.0

Depending on your system, select 32-bit or 64-bit. I downloaded the VC14 x64 Non Thread Safe zip version, that is, the 64-bit Non-Thread Safe version.

Download the package and decompress it to the location you want to store it. Here We decompress it to C: \ php7.0.

Next, double-click the PHP Manager option in IIS, click Register new PHP version, and select php-cgi.exe in the file folder that is just extracted from PHP, as shown in

Click OK to install php7.

You can use IIS to create a website and test whether the PHP file can be accessed normally. For details, refer to the IIS demonstration in the fourth step below.

 

Ii. Installation of PHPStrom 2016.2.1

PHPStrom installation is very simple, Official Website: https://www.jetbrains.com/phpstorm/

Because it is a paid software, in order to be able to use the need to crack, start PHPStrom after selecting license server and then copy the http://jetbrains.tencent.click/this address to go in. Then it can be used normally. I don't know if this address will expire in the future.

 

Okay, PHPStrom has been installed. Because it is in English, if you need a Chinese package, you can search for the Chinese package online and copy the downloaded Chinese package to the lib directory under the PhpStorm installation directory, restart.

 

Iii. Installation of the debugging tool xdebug

Xdebug current latest version is 2.4.1 version, Official Website: https://xdebug.org/download.php

According to the 32-bit or 64-bit version downloaded from your system, the PHP we downloaded earlier is a 64-bit non-thread-safe version, so xdebug also downloads the 64-bit non-thread-safe version, download version: PHP 7.0 VC14 (64 bit)

After the download is complete, save the download file php_xdebug-2.4.1-7.0-vc14-nts-x86_64.dll to the location you want to store, here to facilitate management I will save the file to the ext folder under the PHP file directory.

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.0 \ ext \ php_xdebug-2.4.1-7.0-vc14-nts-x86_64.dll" // here is the storage path of the dynamic link library downloaded by xdebug, it is recommended to use absolute path
Xdebug. remote_enable = 1 // whether the remote terminal is enabled
Xdebug. remote_handler = dbgp
Xdebug. remote_mode = req
Xdebug. remote_host = localhost
Xdebug. remote_port = 9000 // The listening port of the server.
Xdebug. idekey = "PHPSTORM" // here is the keyword of the debugger used in Chrome and FireFox plug-in configuration.

For example

Next, verify that Xdebug is successfully installed.

Enter C: \ php7.0 \ php.exe-m in the command prompt

 

4. Configure Xdebug in PhpStorm

First, start PhpStorm and create a new project. Here I create a new empty project named csPHP with the storage path D: \ csPHP

A new index. php file is created in the project.

Next, open iis and create a website named csphp. Point to the Directory D: \ csPHP of the project we just created. Set port to 801.

Click OK.

Write simple code in the index. php file

Browse in IIS

If you can browse successfully, it indicates that php has been configured.

The browsing address is http: // localhost: 801/index. php.

 

Next, you need to configure it in PhpStorm.

Click file → set

 

Click php in the language and framework

PHP language level 7

Click the Interpreter option.

Click "plus sign" and select

Click OK after setting.

 

Next, set the following settings in the language and framework → PHP → Debug → DBGp Proxy options:

IDE key: PHPSTORM // The value of xdebug. idekey corresponds
Host: localhost // The browsing address of our project
Port: 9000 // This is the Port number

After setting, click OK.

Click "run"> "Edit configuration ".

Click ults → PHP Web Application

Select Google Chrome as the Browser option and click OK.

Because next we will install the Xdebug helper plug-in Google Chrome

Search for Xdebug helper in Google extensions and add

After adding successfully and enabling it, click the option

In the options, select PHPSTORM as the IDE key and save it.

 

All these environment configurations have finally been completed.

 

Finally, test PHPSTORM debugging.

Click this icon in the project to open the listener

Set breakpoint click Google browser for debugging

When the project is first debugged, the following page appears:

Select the entire project and click Accept for acceptance. All project files can be debugged.

 

The debugging result is clear at a glance and can be seen in all the variable results.

 

Now, all the configurations have been completed, and the development project process will be recorded in the future.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.