Home  >  Article  >  CMS Tutorial  >  How to solve the problem that PHPCMS does not support the fsockopen function?

How to solve the problem that PHPCMS does not support the fsockopen function?

Guanhui
GuanhuiOriginal
2020-07-20 13:39:032263browse

How to solve the problem that PHPCMS does not support the fsockopen function?

#PHPCMS does not support the fsockopen function. How to solve the problem?

1. When installing, directly change "step=3" in the address bar and skip this step;

2. Replace the fsockopen function with the pfsockopen function;

3. Modify the code in "client.class.php".

PHP fsockopen function description

Syntax:

resource fsockopen ( string $hostname [, int KaTeX parse error: Expected 'EOF', got '&' at position 20: … = -1 [, int &̲errno [, string &$errstr [, float $timeout = ini_get(“default_socket_timeout”) ]]]] )

Enable PHP fsockopen function

PHP fsockopen requires the allow_url_fopen option in PHP.ini to be turned on.

allow_url_fopen = On

Parameters:

  • hostname If OpenSSL is installed, you may want to add the access protocol ssl:// or tls:/ in front of your hostname address. /, so that you can use the SSL or TLS client based on the TCP/IP protocol to connect to the remote host.

  • port port number. If -1 is passed to this parameter, it means that the port is not used, such as unix://.

  • errno If the return value of errno is 0, and the return value of this function is FALSE, then this indicates that the error occurred before the socket connection (connect()) call, resulting in The most likely reason for the connection failure is that an error occurred when initializing the socket.

  • errstr The error message will be returned as a string.

  • timeout Set the time limit for the connection, in seconds.

Return value:

fsockopen() will return a file handle, which can later be called by other file class functions (for example: fgets(), fgetss(), fwrite () , fclose() and feof() ). If the call fails, FALSE will be returned.

Recommended tutorials: "PHP" "PHPCMS Tutorial"

The above is the detailed content of How to solve the problem that PHPCMS does not support the fsockopen function?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn