How to set up the PHP runtime environment and troubleshoot web servers under IIS

Source: Internet
Author: User
How to build the PHP runtime environment and troubleshoot web servers in iis I. php page completely inaccessible

1. check whether it is a php issue or a problem with servers such as iis.

Method: Place a static file in the directory and use a browser to determine whether the static file can be accessed. If you can access it, it is a php issue.

For IIS problems, there are two common cases. telnet is a powerful tool for judgment.

Linux telnet is actually better, because the echo is enabled by default. For windows, set localecho is required; otherwise, the input text cannot be seen.

1.1 firewall disables port 80

After entering telnet, enter the command, open domain name 80

For example, open www.baidu.com 80

If the connection is available, a black screen will appear, waiting for input

The system prompts that the connection to the host cannot be opened. if Port 80 fails, the Port cannot be accessed. Possible reasons are: the DNS server does not have this domain name (you can use nslookup to query it), the remote host does not enable or disable connection (you can run ping or other commands to check the connection), and as mentioned here, port 80 is not enabled in the firewall.

1.2 The permission settings for the target directory on the server are incorrect

In this case, the logon request dialog box is prompted, so that the page is not displayed.

1.3 Other problems

Assume that the host to be accessed is www.baidu.com, run the following command:

> Telnet www.baidu.com 80

A black screen will pop up, and the speed will be faster at this time, because the server may not wait for you to input, and he is expecting a rapid input. (You can paste it in the notepad first.) directly telnet may not have localecho and may need to be played blindly.

For example, do not enter any characters in the brackets:

GET/HTTP/1.1 (press enter)

Host: www.baidu.com (press enter)

(Press enter)

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

Telnet is used to simulate browser requests to the target host.

Note: the content in the reply header has a wealth of information. for example, 200 indicates that the request is successful. 500 indicates an internal server error. For more information, see the relevant documentation.

1.4 A little background knowledge

The above steps involve the process of initiating a request by the browser. the introduction may be helpful:

1. enter the domain name in the address bar of your browser and press enter.

2. the browser requests the DNS server to convert the domain name to an IP address. Note that this step has nothing to do with your Web Server (IIS or APACHE.

3. the browser requests a connection from your web server, which is equivalent to telnet port 80. Of course, if you specify the port number, it will connect to the port you specified. However, the default port is 80, which is the http port specified by rfc. the https port is 443. this process is more complex, including key exchange and encryption/decryption, therefore, you cannot use this method for trouble shooting. we recommend that you fix http at this stage.

4. a connection is established. the server waits for the browser to send the request header, and 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 (excluding domain names, such as/a.html or/) [space] Protocol

HOST: requested domain name

For example:

GET/index. php HTTP/1.1 (press enter)

Host: www.baidu.com (press enter)

(Press enter)

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

Methods, usually get and post. generally, get is used for webpage requests and post is used for information submission.

6. the server processes and returns data, including the header and webpage body.

HTTP/1.1 200 OK

This line starts with the protocol, error code (or successful code), and error code explanation.

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

There may be many other things in the information body, such as a detailed explanation of this information. When the php error report is enabled, related problems are reported in the header.

2. confirm php Extension loading.

2.1isapi extension

For isapi extensions, under the configuration of the main directory:

Find php:

If not, add it.

2.2 fastcgi method

.

II. php page access

A simple way to determine whether this is the case is to create a php file and enter the following content:

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

This page is very useful.

1. determine whether php files are correctly loaded.

Check whether the php. ini File you want to load is Loaded in the Loaded Configuration File. The file may be modified incorrectly.

2. determine whether mysql and other extensions are loaded

In many cases, the page may be displayed in white, but obviously, the page is loaded in half. For example, the tittle part has been displayed, including supersite, discuz and other sites.

The judgment method is very simple. search for mysql on the page. if there is no such content, it is not loaded.

[1] [2] Next page

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.