PHP Run Environment construction and Web server troubleshooting method under IIS

Source: Internet
Author: User
Tags php error
One, for the PHP page completely inaccessible situation

1. Verify that PHP is a problem or a server such as IIS

Judging method, a static file is placed in the directory and the browser is used to determine if the static file can be accessed. If you can access it, it's a PHP problem.

If this is a problem with IIS, there are two common cases in which a decision is telnet.

Linux Telnet is actually more useful because the default is to turn on Echo. Instead of windows, you need set localecho, otherwise you won't see the text you entered

1.1 Firewall Forbidden 80 port

After entering Telnet, enter the command, open domain 80

Example: Open www.baidu.com 80

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

Indicates that a connection that cannot be opened to a host fails on port 80, which means that the port is unreachable. Possible reasons are: The DNS server does not have this domain name (with nslookup), the remote host does not open or prohibit connection (with Ping and other commands), and here, the firewall does not open 80 port.

1.2 Permissions on the target directory on the server are not set correctly

In this case, you will generally be prompted to log in to the dialog box, not to display the page

1.3 Other issues

Assuming that the host to be accessed is www.baidu.com, then check with the following command:

> Telnet www.baidu.com 80

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

Instruction example, do not enter the characters in parentheses:

get/http/1.1 (carriage return)

Host:www.baidu.com (carriage return)

Enter

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

This is a request to impersonate the browser to the target host with Telnet.

Note that the content of the reply header has very rich information, such as 200, indicating that the request was successful. 500 indicates an internal server error, and so on, the specific information can be seen related documents.

1.4 A little background knowledge

The above steps involve the browser initiating the request process, which may be helpful under the introduction:

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

2, the browser requests the DNS server to convert the domain name to an IP address--note that this step is also not related to your Web server (IIS or Apache).

3. The browser requests a connection to your Web server-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, the process is more complex, there is the process of key exchange and encryption, so there is no way to do trouble shooting this way, it is recommended that at this stage to fix the HTTP first.

4, established a connection, the server waits for the browser to send the request header, the browser sends 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: The requested domain name

For example:

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

Host:www.baidu.com (carriage return)

Enter

The request header may have additional 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 processes and returns data, including header and Web page body.

http/1.1 OK

This line begins with the protocol, as well as the error code (or success code), which is interpreted by the error code.

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

In the information body, there may be many other things, such as a detailed explanation of the information. When PHP error reports are turned on, they are also reported in the header.

2, confirm PHP extension load.

2.1ISAPI expansion

For ISAPI extensions, under the configuration of the home directory:

Find PHP:

If not, add it.

2.2 For the FastCGI method

Another way to load is fastcgi, this method needs to determine whether it is fastcgi engine problem or PHP problem, the method is to skip the fastcgi, directly loaded with CGI Php.exe.

Second, the PHP page section 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:

Note that case and space must be correct. The normal situation is to output a Phpinfo page, as shown in:

This page is very useful.

1, Judge php file load correctness

Confirm that the loaded Configuration file is loaded with php.ini files that you want him to load. It is possible to modify the file error.

2, judge whether the extension of MySQL load

Most of the time this may be the case, that is, the page white screen, but obviously, the page is half loaded. For example, the tittle section has been shown, including sites such as Supersite, Discuz, and so on, which is likely to happen.

Judging method is very simple, the page search MySQL, if not the following content is not loaded

[1] [2] Next

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