Home >Backend Development >PHP Tutorial >fsockopen The pfsockopen function is disabled and SMTP does not send emails properly. Solution_php tips
1: Recently, hackers used fsockopen to carry out PHPDDOS attacks after exploiting program vulnerability injection, causing instability on some servers. Now the dangerous function fsockopen is temporarily disabled. Some program functions may have problems. The following lists the known problems and general solutions:
General solution:
Find the fsockopen function in the program and replace it with: pfsockopen to solve all problems. The difference between the two functions is that pfsockopen remains keep-alive, making it impossible for hackers to carry out connection number attacks.
The path of the program file that uses the fsockopen function is known (add p before fsockopen, that is, change fsockopen to pfsockopen)
Two: The server has disabled fsockopen and pfsockopen at the same time, then use other functions instead, such as stream_socket_client(). Note: The parameters of stream_socket_client() and fsockopen() are different.
Specific operations:
Search the string fsockopen( in the program and replace it with stream_socket_client(. Then, delete the port parameter "80" in the original fsockopen function and add it to $host.
An example is as follows
Before modification:
$fp = fsockopen($host, 80, $errno, $errstr, 30);
After modification:
$fp = stream_socket_client($host."80", $errno, $errstr, 30);
List of files in the website system of domestic mainstream PHP websites involving the fsockopen function:
List of files in the website system of domestic mainstream PHP websites involving the fsockopen function:
DEDECMS:
Discuz! 2.5:
ecms (Empire):
eclassclass.smtp.php
ECSHOP: