PHP + nginx Installation

Source: Internet
Author: User
Tags vc9

Introduction: This is a detailed page for PHP + nginx installation. It introduces the knowledge, skills, and experience related to PhP, PHP, nginx, CGI, FastCGI PHP + nginx installation, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 357337 'rolling = 'no'>

Today, I tried to use nginx as a server in the win2k3 system to run php.

Why nginx?
Small and free installation.

Why FastCGI?
In nginx, If php does not use the FastCGI mode, you need to configure Apache in the proxy mode ..

Go to http://windows.php.net/downloadto download a PHP zip package.
There are four different types of versions: vc9 x86 non thread safe, vc9 x86 thread safe, vc6 x86 non thread safe, and vc6 x86 thread safe. How can I choose?
I. How to select the vc9 and vc6 versions of php5.3
Vc6 is compiled using the Visual Studio 6 compiler. If your PHP is set up using Apache, select vc6.
Vc9 is compiled using the Visual Studio 2008 compiler. If your PHP is set up using IIS, you can select vc9.
Ii. How to select the thread safe and non-thread safe versions of php5.3
First, literally, thread safe is thread security. During execution, the thread security check is performed to prevent the thread from being started when new requirements exist.
The new thread's CGI execution method consumes system resources. Non-thread safe is non-thread security and does not perform thread security checks during execution.
Let's take a look at two PHP Execution Methods: ISAPI and FastCGI.
The ISAPI is executed in the form of a DLL dynamic library. It can be executed after a user request and will not disappear immediately after a user request is processed. Therefore, thread security check is required to improveProgramSo if ISAPI is used to execute PHP, we recommend that you select the thread safe version;
FastCGI executes operations in a single thread, so it does not need to perform thread security checks. Apart from the thread security check protection, it can improve the execution efficiency, if you use FastCGI to execute PHP, we recommend that you select the non-thread safe version.

Because I have a vc9 library on my computer and I want to use nginx to run php-FastCGI, I can directly download the zip installation-free version of the safe version of vc9 x86 non thread.
Note: If the package is not installed, download Microsoft Visual C ++ 2008 SP1 redistributable package (x86!

install PHP:
1. Decompress php-5.3.0-nts-win32-vc9-x86.zip to D: \ PHP;
2. Copy D: \ PHP. ini-Development and rename it D: \ PHP. INI
3. Edit D: \ PHP in notepad. INI
1) set the system default time zone to China
search; date. timezone =
changed to date. timezone = PRC
2) set the extension package directory
search; extension_dir = "Ext"
to extension_dir = "Ext"
3) open the extension packages such as GD2 and MySQL.
search for them separately. Extension = php_gd2.dll and extension = php_mysql.dll
remove the preceding ones.
4) D: \ PHP creates a new notepad file
php-cgi.exe-B 127.0.0.1: 9000-C PHP. INI
rename or save it as startup. bat

Install nginx
1. Go to http://sysoev.ru/nginx/download.htmlto download nginx's latest windows nginx/windows-0.8.21.zip
2. Decompress nginx-0.8.21.zip to D :\
3. Use notepad to open D: \ nginx-0.8.21 \ conf \ nginx. conf
4. Search for # location ~ \. Php $ {
Set
# Location ~ \. Php $ {
# Root HTML;
# Fastcgi_pass 127.0.0.1: 9000;
# Fastcgi_index index. php;
# Fastcgi_param script_filename/scripts $ fastcgi_script_name;
# Include fastcgi_params;
#}
Change
Location ~ \. Php $ {
Root HTML;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param script_filename $ document_root $ fastcgi_script_name;
Include fastcgi_params;
}

5. Search for Location /{
Set location /{
Root HTML;
Index index.html index.htm;
}
Change to location /{
Root HTML;
Index index.html index.htm index. php;
}
Save and disable nginx. conf

==================== I am the border between legends

Start the service:

Enter D: \ PHP \ and execute startup. BAT to start php_fastcgi
Enter D: \ nginx-0.8.21open nginx.exe

The logging manager can see that two nginx.exephp-cgi.exe processes in the process indicate that the startup is successful.

Browse http: // localhost/

Open the folder D: \ nginx-0.8.21 \ html
Delete index.html and create index. php as <? PHP phpinfo ();?>

Refresh http: // localhost/

This is a pure green installation. If you want to enable the Service to run automatically at startup, add it as a system service.

Reprinted from: http://hi.baidu.com/eisn/blog/item/74ce78894b518ab90f24446a.html

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/357337.html pageno: 2.

Related Article

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.