Step by Step PHP (a): Under Windows configuration Nginx + PHP development environment

Source: Internet
Author: User
Tags php development environment phpinfo vc9
Step by step PHP (1): Configure Nginx + PHP development environment under Windows
1. Download and install Nginx
  • 1.1 Download Address: http://nginx.org/en/download.html
  • Http://nginx.org/download/nginx-1.3.0.zip
  • 1.2 Extracting Nginx-1.3.0.zip to G:\webserver
  • 1.3 To G:\webserver Rename the nginx-1.3.0 folder to Nginx

  • 2, start the Nginx and test the Nginx normal operation
  • 2.1 To G:\webserver\nginx execute Nginx.exe, in Task Manager can see Nginx.exe process exists
  • 2.2 In the browser input http://127.0.0.1, you can see "Welcome to Nginx!" Indicates Nginx is operating normally

  • 3. Learn the difference between VC9, VC6, thread safe, Non thread safe in PHP version
  • 3.1 Differences between VC9 version and VC6 version
  • The VC6 version is compiled with the Visual Studio 6 compiler, and if your PHP is built with Apache, you choose the VC6 version.

    The VC9 version is compiled with the Visual Studio 9 (2008) compiler, and if your PHP is built with IIS, you choose the VC9 version.
  • 3.2 The difference between the thread safe and the Non thread safe version
  • In the first place, it is a thread safe to understand the literal meaning that thread security is performed in order to prevent the new requirements from exhausting system resources by starting the CGI execution of new threads. Non thread safe is non-threaded and does not thread (thread) security checks at execution time.

    Let's look at two ways of executing PHP: ISAPI and FastCGI.

    ISAPI execution mode is used in the form of DLL Dynamic library, can be executed after the user request, after processing a user request will not disappear immediately, so the need for thread security check, so as to improve the execution efficiency of the program, so if it is to execute PHP with ISAPI, it is recommended to choose thread Safe version;

    The FastCGI execution is performed with a single thread, so there is no need for thread security checks, and the removal of thread safety checks can improve execution efficiency, so if PHP is executed in FastCGI, it is recommended to choose the Non thread Safe version.

    4. Download and install PHP
  • 4.1 Download Address: http://windows.php.net/download
  • Http://windows.php.net/downloads/releases/php-5.4.3-nts-Win32-VC9-x86.zip
  • 4.2 Creating subfolders under the G:\webserver directory PHP
  • 4.3 Unzip the php-5.4.3-nts-win32-vc9-x86.zip to the G:\webserver\php directory

  • 5. Create a source file directory
  • 5.1 Copy the HTML directory under the Nginx directory to the G:\webserver\ directory and rename it to Webroot

  • 6. Configure and start Nginx
  • 6.1 The difference between G:\webserver\nginx\conf\nginx.conf and unmodified is as follows:
  • [Root@localhost test]# diff nginx.conf Nginx.conf.default 44,45c44,45<             root   g:/webserver/webroot;<             index  index.html index.htm index.php;--->             root   html;>             index  index.html index.htm; 65,70c65,71< location         ~ \.php$ {<             fastcgi_pass   127.0.0.1:9000;<             fastcgi_index  index.php;<             fastcgi_param  script_filename  g:/webserver/webroot$fastcgi_script_name;<             include        fastcgi_params;<         }--->         #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;>         
  • 6.2 In the command line state, the NGINX.EXE-T test configuration file is correctly executed under the G:\webserver\nginx directory
  • 6.3 Execute Nginx.exe startup Nginx in G:\webserver\nginx directory
  • 6.4 Under command-line state, perform nginx.exe-s stop nginx,nginx.ex-s reload reload configuration under G:\webserver\nginx directory

  • 7. Configure and start PHP
  • 7.1 To G:\webserver\php directory, in order to save the original configuration file, copy Php.ini-development to Php.ini.default
  • 7.2 Rename php.ini-development to PHP.ini (there are php.ini and php.ini.default two identical profiles)
  • 7.3 Open php.ini, find Short_open_tag = Off Modify to find Short_open_tag = On
  • 7.4 In order to open the common extension and set the default time zone to Chongqing, add the following to the end of the file:
  • Extension_dir = "G:\webserver\php\ext" Extension=php_curl.dll extension=php_gd2.dll Extension=php_mbstring.dll Extension=php_mysql.dll Extension=php_mysqli.dll Extension=php_pdo_mysql.dll Extension=php_pdo_sqlite.dll Extension=php_sockets.dll extension=php_sqlite.dll extension=php_sqlite3.dll Extension=php_exif.dll date.timezone = Asia/chongqing
  • 7.5 and unmodified configuration file Php.ini.default comparison, the difference is as follows
  • 7.6 Starting Php:g:\webserver\php\php-cgi.exe-b 127.0.0.1:9000-c G:\webserver\php\php.ini


  • 8, test the PHP development environment configuration successfully
  • 8.1 Create the phpinfo.php in the Webroot directory and save the following:
  • Phpinfo
     
      
      
       

    Welcome to PHP

  • 8.2 In the browser input http://127.0.0.1/phpinfo.php can see "Welcome to PHP" and phpinfo information, indicating that the PHP configuration is successful

  • 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.