Construction of PHP running environment under IIS and Troubleshooting method of Web server _win server

Source: Internet
Author: User
Tags convert domain name to ip address error code phpinfo

One, for the PHP page completely inaccessible situation

1, to confirm that the problem is PHP or IIS and other server issues

Judging method, in the directory to decentralize a static file, through the browser to determine whether the static file can be accessed. If you can access, that is the PHP issue.

If it's a problem with IIS, there are two common scenarios, and a sharp weapon for judgment is telnet.

The Linux telnet is actually more useful, because the default is to turn on Echo. Windows, you need to use set Localecho, otherwise you won't see the text you entered.

1.1 Firewall prohibits 80 ports

After entering Telnet, enter the command, open domain 80

such as: Open www.baidu.com 80

If you can connect, a black screen will appear, waiting for input

Hint that a connection that cannot be opened to the host fails at Port 80, indicating that the port is unreachable. Possible reasons: The DNS server does not have this domain name (with nslookup), the remote host does not open or prohibit the connection (ping, etc.), and here, the firewall does not open 80 ports.

The permissions on the target directory on the 1.2 server are not set correctly

In this case, you will generally be prompted to sign in to the dialog box so that the page does not appear

1.3 Other questions

Suppose the host you want to access is www.baidu.com, then check with the following command:

> Telnet www.baidu.com 80

Will come out a black screen, this time faster, because the server may not wait for you to input, he is expecting a quick input. (You can play in Notepad first, then paste in), direct telnet may not localecho, may need to blind

Instruction example, do not enter the characters in parentheses:

get/http/1.1 (carriage return)

Host:www.baidu.com (carriage return)

Car

Note that there are two carriage returns after the host row.

This is using Telnet to simulate the browser's request to the target host. As shown in figure:

Note that the contents of the reply headers have very rich information, such as 200, which indicates a successful request. 500 indicates internal server error, etc., the specific information can look at the relevant documents.

1.4 Little background knowledge

The above steps involve the process of requesting a browser, which may be helpful:

1, you enter the domain name in the address bar of the browser, and press ENTER.

2, the browser requests the DNS server to convert domain name to IP address-note that this step also and your Web server (IIS or Apache) have no relationship.

3, the browser to your Web server request connection--the equivalent of our Telnet 80 port. Of course, if you specify a port number, he will connect to the ports you specify. But the default port is 80, this is the RFC-specified HTTP port, HTTPS port is 443, this process is more complex, there is key exchange and decryption process, so there is no way to do trouble shooting, the proposed in this phase to do HTTP first.

4, set up a connection, the server waiting for the browser to send request headers, the browser to send the request header. The request header ends with a blank line.

5. The request header format is as follows:

Method "Space" request path (does not include domain name, such as/a.html or/) "Space" protocol

HOST: Requested domain name

For example:

get/index.php http/1.1 (carriage return)

Host:www.baidu.com (carriage return)

Car

The request header may have other information, such as the submitted information, but for us this is enough.

method, commonly used is get and post, the General Request Web page with get, submit information with post.

6, the server processing and return data, including headers and web-body.

http/1.1 OK

This line begins with a protocol, an error code (or a success code), and an error code explanation.

There may be a lot of information useful for browsers, but it is necessary for us to know the code and the error code interpretation.

In the information body, there may be many other things, such as a detailed explanation of this information. When the error report of PHP is turned on, it will also report the related issues here.

2, Confirm PHP expansion load.

2.1ISAPI extension

For ISAPI extensions, under the home directory configuration:

Find PHP:

If not, add them.

2.2 For FastCGI method

Another method of loading is fastcgi, this method needs to determine whether the fastcgi engine problem or PHP problem, the method is to skip fastcgi, directly loaded with a CGI php.exe.

Second, the PHP page part can access the situation

The simple way to judge whether this is the case is to create a new PHP file and enter the following:

<?php phpinfo ();?>

Note that the case and space must be correct. Normally, the next output is a Phpinfo page, as shown in the following illustration:

This page is useful.

1, to determine the correctness of PHP file loading

Make sure loaded Configuration file is loaded with php.ini files that you want him to load. It is possible to modify the file incorrectly.

2, to determine whether the extension of MySQL load

Many times there may be a situation where the page is screen, but obviously the page is half loaded. For example, the tittle section has been shown, including Supersite, Discuz and other sites that are likely to occur.

The judgment method is very simple, the page searches MySQL, if does not have the following content is not loaded

2.1, to determine why did not load

The two main possibilities: Extension_dir no configuration and no uncomment

2.2. The first possibility

Extension_dir is not configured, note to configure to the EXT directory, for example:

Extension_dir= "E:\PHP\EXT"

Remember to confirm that the directory is not present

2.3. The second possibility

Extension did not cancel the annotation. See if there is this sentence and the front of this sentence there is no #, if any, remove.

[Php_mysql]

Extension=php_mysql.dll

2.4. Other

The online version to copy two and MySQL-related files to Windows, but the actual configuration seems to have nothing to do with this, but the above are not resolved, you can try.

3, Trouble shooting method

Open Display_errors and Display_startup_errors, there will be some errors displayed on the page, for example, mysql_connect undefined and so on. Through these false hints, can be targeted to find the source of the error.

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.