Build Nginx + memcache + xdebug + php running environment green edition For windows

Source: Internet
Author: User
Tags vc9

Nginx is better than apache and has many advantages. You can find the tracing materials by searching for the engine. This is not the focus of our discussion. We focus on making a running combination by ourselves!
Why don't I create a new version that someone else has already subscribed to from the Internet? Because many people do not update the token after it is closed, and they do not know how to do it if they want to update it. In this case, it is better to study the token by yourself, in the future, you will not need to ask for help!

Let me talk about the features of this combination:

The main structure is 1.Php 5.3 2. nginx 1.3.6 3. memcache 2.2.6 4. xdebug v2.2.1 considerations: 1. do not intentionally modify the path of the file. It is best to put it under d:/wnmp. If you must modify the path, you must follow the following rule. 2. because the cgi mode is used to run php, the php version needs to be selected. do not select a PHP version that is too high, because memcache is very secure or cannot find the corresponding version of dll 4. if php uses the 32-bit version of vc9, then memcache should also select the corresponding version of dll 5. after a normal environment is set up, there should be at least three processes, with ports 80 for nginx, 11211 for memcache, and 9000 for php-cgi 6. when determining multiple domain names, renew one copy/wnmp/_ conf /?. Conf, and then perform restart. After the restart is completed, restart Nginx or reload. when you add a website, you cannot use "\" for the resource. For example, D:/wnmp/nginx1.3/_ www/. If you want to modify the path: 1. first, modify setup. bat and stop. path 2 in bat. modify php. ext path in ini 3. modify nginx. path 4 in conf. modify the statement usage in each conf example in _ conf: 1. start. bat 2. stop. bat 3. put the PHP Flood case under/wnmp/_ www.

From the above description, we can see that I did not add mysql to this combination or zend, but added xdebug. The reason is very simple: I need this combination for development. my current server is the CentOS operating system and the database is Redis, so this combination cannot be officially used for production. If you want to build a production debugging environment, so I suggest you remove xdebug and add zend and eAcc. In addition, when you release the firmware, you need to release the tar-based versions. the database does not need to be integrated into this combination. It can be installed independently.

Now, let me explain in detail how to build this combination,First, prepare the software. We need:

1.php-5.3.0-nts-Win32-VC9-x86.zip is: http://windows.php.net/downloads/releases/archives/

Note: Be sure to download the enhanced version of the default version. Otherwise, it will not be able to run in cgi Mode. In addition, I did not select a higher version of php because the higher version is not stable enough, and it is difficult to find memcache in addition to the higher version; dll files such as xdebug

2. Nginx 1.3.6 is: http://nginx.org/

Note: To download the ZIP file, do not download the. bzor. Tar compressed package. These are all linux versions.

3. Download memcache and xdebug dll file is: http://downloads.php.net/pierre/

Note: When downloading the dll, be sure to match the php version or the installation will never succeed. For example: Success

4. The slave address under the slave RunHiddenConsole is: http://redmine.lighttpd.net/attachments/660/RunHiddenConsole.zip

Note: RunHiddenConsole.exe can automatically close the script after executing the command line script, but the process enabled from the script is not closed.

 

Operation Method:
1. In d: Create a wnmp Object repository, create a php5.3 Object repository under wnmp, and extract the php program repository package obtained from the following repository.

2. Find php. ini-development and change it to php. ini. Then, open and modify the content:

Remove the shard of the Left segment of cgi. fix_pathinfo = 1.

Find extension_dir and remove the left shard and change it to extension_dir = "d:/wnmp/php5.3/ext"

Find extension = ???. Dll to see which components you need and remove the left Partition

3. Create a nginx1.3 project under wnmp, deploy nginx, modify nginx. conf under conf, and change the content:

# User nobody; worker_processes 1; events {worker_connections 1024;} http {include mime. types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; # The purpose of include is to set multiple domain names to multiple domain names and include D: /wnmp/_ conf /*. conf ;}

4. Create an alias for the _ conf file and an alias for the _ www file under wnmp, and then create a.com. conf under _ conf. The content is as follows:

Server {listen 80; # port server_name www.a.com; # bind a Domain Name and add multiple domain names by spaces. Index index.html index.htm index. php; # default document. add multiple default documents by space. Root D:/wnmp/_ www/_ a; # address of the website file. The directory is in the form. Otherwise, errors may occur. Autoindex on; # Whether to enable the specified category. If it is off, It is disabled. Charset UTF-8; # encoding error_page 404/404 .html; #404 error code specifies the file location =/404.html {# The document root D:/wnmp/_ www displayed in the error code; # error file directory} error_page 500 502 503 504/50 x.html; # 50x Error Code specifies the file location =/50x.html {# root D:/wnmp/_ www; # error file directory} location ~ \. Php $ {root D:/wnmp/_ www/_ a; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME $ document_root $ callback; include fastcgi_params;} location ~ /\. Ht {deny all ;}}

Create B .com. conf again, with the content:

Server {listen 80; # port server_name www. B .com; # bind a Domain Name and add multiple domain names by spaces. Index index.html index.htm index. php; # default document. add multiple default documents by space. Root D:/wnmp/_ www/_ B; # address of the website file. The directory is in the form. Otherwise, errors may occur. Autoindex on; # Whether to enable the specified category. If it is off, It is disabled. Charset UTF-8; # encoding error_page 404/404 .html; #404 error code specifies the file location =/404.html {# The document root D:/wnmp/_ www displayed in the error code; # error file directory} error_page 500 502 503 504/50 x.html; # 50x Error Code specifies the file location =/50x.html {# root D:/wnmp/_ www; # error file directory} location ~ \. Php $ {root D:/wnmp/_ www/_ B; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME $ document_root $ partition; include fastcgi_params;} location ~ /\. Ht {deny all ;}}

Through the above operations, we have already created two websites under D:/wnmp/_ www. Their differences are:

D: The domain name specified by/wnmp/_ www/_ a is www.a.com.

D: The domain name specified by/wnmp/_ www/_ B is www. B .com.

The nginx + php environment has been initially configured. We can use the command to activate the environment.:

D:/wnmp/php5.3/php-cgi.exe-B 127.0.0.1: 9000-c d:/wnmp/php5.3/php. ini

In this way, you can activate the Service Manager to check the progress, or use netstat to check whether the port is used. If the port is normal, port 9000 should be used.

Nginx can also be manually started. Run the "restart failed" command to check the following:

D:/wnmp/nginx1.3/nginx.exe-p D:/wnmp/nginx1.3

After the switchover, you will find that port 80 is used.

If the two parts of the last commit are successful, then you have already succeeded more than half of them.

Next, we need to configure memcache and xdebug. I have already said this before, I am installing these two parts for the convenience of development, so I want to use debug's things and memory parts. If you want to set up a formal server, then, run zend; memcache and eAcc at this time. however, it should be noted that zend and xdebug cannot coexist, and they will be abrupt, because their peers are busy !!!

Now we have installed memcache and xdebug:

Run the dll downloaded from our workshop to the/wnmp/php5.3/ext file, and then modify php. ini to use extension = ???. Dll merge.

Xdebug should use the following method to import:

; Load Xdebug [Xdebug] zend_extension = "D:/wnmp/PHP5.3/ext/php_xdebug-2.2.1-5.3-vc9-nts.dll"; Whether to enable internal release xdebug. profiler_enable = on; Whether to enable automatic and xdebug. auto_trace = On; Whether to enable exception tracking xdebug. show_exception_trace = On; Whether to collect the variable xdebug. collect_vars = On; Whether to collect the returned value xdebug. collect_return = On; Whether to collect xdebug parameters. collect_params = On; release xdebug with zookeeper. trace_output_dir = "D:/wnmp/tmp/xdebug"; zookeeper releases xdebug. profiler_output_dir = "D:/wnmp/tmp/xdebug"

Note: we are using the ETS version, so we need to use the zend_extension method to import the data.

Restart nginx to complete the process. in order to facilitate the operation and operation, I wrote a batch of Operations for processing and stopping the operation. The generation is as follows:

Rem, Which is start. bat @ echo offcolor 06REM is invalid in Windows. REM set PHP_FCGI_CHILDREN = 5 call stop. maximum number of requests processed by each batREM process, or set it to the Windows environment variable set PHP_FCGI_MAX_REQUESTS = 1000 echo Starting Memcache 2.2.6... "D:/wnmp/memcache/memcached.exe"-d install "D:/wnmp/memcache/memcached.exe"-d start echo Starting php-5.3.0-nts-Win32-VC9-x86 FastCGI... runHiddenConsole D:/wnmp/php5.3/php-cgi.exe-B 127.0.0.1: 9000-c D:/wnmp/php5.3/php. ini echo Starting Nginx 1.3.6... runHiddenConsole D:/wnmp/nginx1.3/nginx.exe-p D:/wnmp/nginx1.3pause
Rem, this is stop. bat @ echo offecho Stopping Nginx... taskkill/F/IM nginx.exe> nulecho Stopping PHP FastCGI... taskkill/F/IM php-cgi.exe> nulecho Stopping Memcache... "D:/wnmp/memcache/memcached.exe"-d stopcls

Finally, I will provide the Nginx + memcache + xdebug + php runtime environment for you to refer:

The lower region address is: http://download.csdn.net/detail/sibang/4805911

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.