Set up the PHP5.6 environment in WIN8.1. Many people prefer to use linux to build the php environment under WIN8.1. However, because linux is highly customized, you often need to run the root command, which is somewhat high-end, build the PHP5.6 environment under the corresponding micro-WIN8.1
Many people prefer to use linux to build a php webpage running environment. However, because linux is highly customized, it often requires the root to run commands, which is somewhat high-end and corresponds to the Microsoft windows operating system, the user experience is good. you can use the IIS component + PHP package provided by windows to build a suitable runtime environment.
The first time I came into contact with php was around-. at that time, I was focusing on C #, and I was reluctant to use php. many of the reasons are that PHP breakpoint debugging has never been successful, the echo method is used to print logs, causing resentment against php, and missing a good opportunity to study php in depth. This article aims to record the beginning of php and help beginners who are new to php to configure the php environment smoothly, without fear of php.
1. system environment overview
Windows is a very common system. I believe there is no need to explain more here. So how to enable IIS (win8.1) is actually there are many tutorials on the internet. I will only give a brief introduction here.
① Install. net fromework 3.5
IIS depends on. net3.5. Therefore, the first step is to install. net fromework3.5. There are roughly two installation methods: Online download, which is very slow (really slow). here we will introduce the second method: offline installation of. net fromework3.5. Find the iso file for win8 installation and load it to the virtual optical drive. if there is an engraved USB flash drive, insert it to the USB flash drive. Run inventory/online/enable-feature/featurename: NetFX3/Source: V: \ sources \ sxs. disk V indicates the drive letter of the virtual optical drive or the drive letter of the USB flash drive.
② Enable IIS
For development, it should be a small case to enable IIS. I will not talk about it here.
II. Installation
The initial IIS does not support php, so we first download the PHP Manager tool. after the installation is successful, we can see the php manager icon in IIS, for example:
Go to php manager. Subsequent configuration is relatively simple. please use baidu. the focus of this article is on breakpoint debugging, so it will not be too long-winded. After the php configuration is complete, the following page is displayed:
Copy the decompressed xdebug file downloaded to the ext folder in the php directory.
The next step is the IDE installation. PHPStorm installation is still very simple. I will not talk about it here. Xdebug helper is an extension tool of Chrome. enter chrome: // extensions/in the browser /, drag the downloaded crx file into the page.
III. configuration
① Xdebug
Xdebug configurations are found on the internet. only my configurations are provided here. in the php. ini file, add the following code. pay attention to the location of several files.
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[Xdebug]; xdebug configuration 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" ; Load Xdebug xdebug.idekey= "PHPSTORM" xdebug.profiler_enable=on xdebug.trace_output_dir= "D:/php/xdebug-log" Xdebug data file directory xdebug.profiler_output_dir= "D:/php/xdebug-log" Xdebug data file directory Xdebug. auto_trace = On; enable automatic tracing Xdebug. show_exception_trace = On; enable exception tracking Xdebug. remote_autostart = Off; enable automatic start of remote debugging Xdebug. remote_enable = On; enable remote debugging Xdebug. remote_handler = dbgp; application layer communication protocol used for remote debugging of zend studio Xdebug. remote_host = localhost; IP address of zend studio that can be connected Xdebug. remote_port = 9001; reverse connect to the port used by zend studio Xdebug. collect_vars = On; collect variables Xdebug. collect_return = On; collect return values Xdebug. collect_params = On; collect parameters Xdebugbug. max_nesting_level = 10000; if it is too small, if the number of recursive calls in a function is too many, the system reports an error that exceeds the maximum number of embedded sets. |
② PHPStorm
Go to php settings
Select php language settings
Add an interpreter. 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 the interpreter as follows, press Alt + F2. You do not need to install IIS to run php through the interpreter.
The next step is to configure phpStorm debug. In fact, phpstorm debug is basically set by default, but we 'd better modify it, because Port 9000 may be occupied by other applications. So we need to change to another port, such as 9001
Note: the port here must be consistent with the port configuration in xdebug in php. ini. please refer to the above configuration code.
Xdebug. remote_port = 9001; reverse connect to the port used by zend studio
③ Xdebug helper
It is a plug-in of Chrome, which is really easy to use and easy to configure.
The configuration is almost complete. Let's test it.
IV. breakpoint debugging and testing
① Find the page, enable debugging, click the bug, and select Debug.
② Enable PHPstorm listener
Refresh the http: // localhost/php/FirstPHP. php page
Running result:
The results are running correctly. this article ends, hoping to help viewers.
The above is all the content of this article. I hope you will like it.
Many people prefer to use linux to build a php webpage language runtime environment. However, because linux is highly customized, you often need to run the root command, which is somewhat high-end and corresponding to the micro...