The cause of the problem is that the page on the WordPress background is slow or even unresponsive in the local environment, excluding the Google font or the reference of third-party ajax, the page prompts "an unexpected error may occur in WordPress.org or the server configuration file". The debug program returns name lookup timed out and reports an error.
For example, when these two pages are opened in the background, they are extremely slow:
The local url is as follows.
Ps: I recently had nothing to do with a WordPress plug-in and I was interested in WordPress. So I went back to the Mac OS X local environment (MAMP integrated environment) and installed a WordPress, I found the problem mentioned above.
Let's get down to the truth. Therefore, you can perform breakpoint debugging in PHPstorm and xdebug to find the stuck location. It will forward.
The returned error message "name lookup timed out" is returned by the server. This statement is not found in the program.
Open the debug mode of WordPress, refresh the page, and wait for half a day. An unexpected error may occur. There may be a problem with WordPress.org or the server configuration file, which is described at the beginning of this article. The corresponding program is in English:
An unexpected error occurred. Something may be wrong with WordPress.org or this server...
After searching for this sentence on the Internet, we found that many people encountered this problem, but there was no clear solution. Some netizens mentioned that this was because of the folder permission problem in the Linux system, you need to set the readable and writable permissions for the wp-uplodes and wp-contents folders and subfolders. Although not convinced, I still do it.
On the terminal, run the following command to modify the folder permissions:
Chmod-R
Chmod-R o + wx wp-content/
Here, "-R" indicates recursively modifying the file and its subfolders, "o" indicates other owner (other), and "wx" indicates writable and executable permissions.
Shell
Ls-l
Displays all files in the folder and permissions.
After the change, I still couldn't do it. Later I simply changed all the folders in the entire WordPress directory to everyone (o, g, u) with the readable and executable permissions, but I still couldn't. Eliminate this cause.
It seems that the error "name lookup timed out" still exists. I checked it online and said that the linux server stopped working because of nameservers, resulting in name lookup timed out. I want to modify the nameserver ver ING, in Mac/private/var/run/resolv. conf file:
#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# Or the DNS query routing mechanisms used by most processes on
# This Mac OS X system.
#
# This file is automatically generated.
#
Search DHCP HOST
Nameserver 192.168.0.1
Nameserver 192.168.1.1
If two 8.8.8.8 and 8.8.4.4 are added, this method will not work.
Later I found the same problem in statcoverflow, someone mentioned it could be that the timeout setting for the request was short, http://stackoverflow.com/questions/21871850/wordpress-update-operation-timed-out-after-5000-milliseconds
I tracked it down to this line in WP_Http_Curl: request ()
PHP
Curl_setopt ($ handle, CURLOPT_CONNECTTIMEOUT, $ timeout );
The function's default timeout is 5, however WP_Upgrader: upgrade () actually cballs the function via a download_package function passing in a 300 seconds timeout.
Therefore, the code modification timeout time before the post request is sent is longer:
Timeout
Refreshing the page went smoothly.
But after the code is restored, everything is normal. Is it a problem with local DNS? After a successful attempt to change the timeout time, the local DNS is cached, so the code can be requested quickly after being restored.
The default timeout value is 5 s. Assume that the data is returned in 7 s. Because the data is automatically timed out in 5 s, the previous request fails to return and the data is returned normally after the timeout value is extended. It seems that the local dhcp host is still a problem. If the resolution is not successful or the response is slow, the DNS information is cached after the connection is successful.