PHP setup and web server troubleshooting

Source: Internet
Author: User
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. "> <LINKhref =" http://www.php100.com//statics/style/headfloor_950_081205.css"

 

I. completely inaccessible php pages

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.

Set10CaleCho enable crosoftTelnet> open for discussion. Baidu. Coo555 is connected,. B. Idu ....... The connection to the host cannot be opened. In Port 555: connection failed crosoftTelnet> opennot 1 exists on connection not 1 exist 1 cannot open the connection to the host. On the port, crosoftTelnet> open. Baidu. Coos is connecting .,.. Baidu ....... "Src =" http://www.php100.com/uploadfile/2012/1028/20121028111849417.png "/>

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:

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

(St, ie> htoi {ove, fio, one,: auto, bod Xi (font: 12pxa rough ial; text a align: cente protection; backg protects ound: lin fff bod Xi, p, forn, ul, 11 (nargin: 0; padding: O; list one st Xi le: none} bod Xi, ., Lin f. {Position: relative) td (text a align: left, ing (border: Day} a (color: Forest Day c} a: actiue (colo protection: lin f6} Lin u {color: Lin, 9,; padding: 4pxl pxspx; text 1 align: Aight} Lin ua No rough epeat 3 4px; borde protection: lpxsolid forest b6b6b6; l, orde protection a color: Forest, a forest cdcdcd forest cdcdcdcd forest, aga, a; uertical a align: top }. S_ip< "idth: 4 SPx; height: 22px; font: 16px/22 pxarial; na rgin: spx? Px; background: Lin fff; outline: none; ebklt: appea protection: none }. S a btn {lining id old mouth "src =" http://www.php100.com/uploadfile/2012/1028/20121028111849848.png "/>

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:

 
  1.     

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.

2.1. judge why not load

There are two main possibilities: extension_dir: no configuration pair and no uncomment

2.2. first possibility

 

Extension_dir is not configured correctly. Be sure to configure it in the ext Directory, for example:

Extension_dir = "E: \ PHP \ EXT"

 

Check whether the directory exists.

2.3. second possibility

Extension does not cancel comments. Check whether this sentence is correct or not. If yes, remove it.

 

[PHP_MYSQL]

Extension = php_mysql.dll

 

2.4 Others

The online statement involves copying two mysql-related files to windows. However, the actual configuration process does not seem to be related to this file. if none of the above solutions are available, try it.

3. trouble shooting method

When display_errors and display_startup_errors are enabled, some errors are displayed on the page, for example, mysql_connect is not defined. Through these error prompts, you can 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.