php windows IIS installation and configuration services

php windows IIS installation and configuration services

Start IIS service

  1. Open the "Control Panel" => "program" => "Enable or disable Window function":

img

  

  1. Then select the corresponding settings:

img

  

  1. Continue by selecting the corresponding directory CGI module (mounted to the use configuration php):

img

  

  1. At this point in the "C drive" will be more than a folder "inetpub", open look inside the directory structure

img

img

  

  As shown above, the price of each file stored in different files, history, logs, etc., I do use the "wwwroot" folder, which has a html file is opened after a picture is displayed in the content server home page, browsing open the computer's IP address, you can visit this page of (do not know the ip address of words, win + R, type cmd to open the terminal, enter the command ipconfig to see the machine IP).

  I have to replace the files inside:

img

  

  In the browser opens:

img

  

  1. You can modify the permissions of a folder, so that each time you modify a file, when not prompted to deny access to information such as:

  Select "wwwroot" folder => right click "Properties" => "Security" => "Advanced":

img

  Select the corresponding "subject", click Edit, check the appropriate access rights to:

img

img

2. Install php

  Download: https://windows.php.net/download

  Select the appropriate version, here I downloaded the zip file, extract to the C drive "C: /php-7.1.21", after the extraction is completed into the folder, the file php.ini-development rename php.ini, by editor opens search:

; extension_dir = "./"  修改为 extension_dir = "c:/php-7.1.21/ext" ( 前面的分号去掉,引号内为安装php的路径);cgi.force_redirect = 1 修改为 cgi.force_redirect = 0 ( 去掉前面的分号,值修改为1 );cgi.fix_pathinfo = 1 修改为 cgi.fix_pathinfo = 1 ( 去掉前面的分号 );fastcgi.impersonate = 1 修改为 ;fastcgi_impersonate = 1 ( 去掉前面的分号 )

  Save and exit.

  In the search box search window IIS, enter the "IIS Manager" => Open "Handler Mappings" => "Add Module Mapping":

img

  

  Modify as follows:

img

  Then create a php file, saved in the "wwwroot" directory, open a browser to access:

<?php
    echo "hello world!";
?>    

img

Configuring the system environment variables

Environment variable configuration system is able to be able to execute php cmd command shell or other tool in any directory path, is arranged in the Path entry system variables plus a current path to the directory php. With Win10 example:
在这里插入图片描述

After saving is complete, reboot cmd to execute a php command in any directory path.

PHP configuration file settings

In the default PHP installation directory has the executable file php.ini-development and php.ini-production profiles of these two styles, which is the reference file, not the actual functioning of the configuration file, the main difference is that the two default settings the error handling in different ways. Here I choose php.ini-development copy in the same directory and renamed the php.ini, and then modify the content to be complete copy php.ini to the C: \ Windows \ directory, the configuration file to take effect.

img

Set the time zone

Disposed before the entry removed;, set a value of PRC

在这里插入图片描述

Open openssl, mbstring, crul, mysqli, pdo_mysql and other extensions

在这里插入图片描述

The default configuration file is closed, these extensions, the extension file is already on ext PHP installation directory under the directory, so just leave a comment here before you can use the line-related extensions.
Finally, the placement of the edited configuration file to the C: \ Windows \ directory to take effect.

Start playing

Turn on the built-in server
using the PHP built-in server we can easily develop the project up and running, and only takes a single command can be realized. The entire command is php -S localhost: 1023 -td: \ code \ lv56 \ public, after -S is connected to the server address and port, then the back entrance -t directory path of the project. -T which is optional, with no word on the default directory is the directory entry cmd command currently being executed. After opening can use ctrl + c key combination to terminate the server process.
开启

Use interactive mode

When using the interactive mode without editing the file, execute code directly for simple code test scenarios. Execute the command line, php -ayou can enter the interactive mode. Note end of each line of code to add ;, or will be treated as the bank statement is not over, but then an error or is not executed.
在这里插入图片描述

Guess you like

Origin www.cnblogs.com/h-gallop/p/11762408.html