Php fsockopen () function disabling solution

Source: Internet
Author: User

It is very easy for a friend with server permissions to perform operations

Open the php. Ini file and find allow_url_fopen.

Change allow_url_fopen = On to allow_url_fopen = Off

Find disable_functions and find

Disable_functions = fsockopen: delete the fsockopen.

If you do not have Server permissions, we can use pfsockopet instead.

 

The code is as follows:

$ Fp = fsockopen ($ host, 80, $ errno, $ errstr, 30 );

After modification

$ Fp = pfsockopen ($ host, 80, $ errno, $ errstr, 30 );

Some services are also killed without the pfsockopen function, so we can use the stream_socket_client () function, but the stream_socket_client () parameter is different from fsockopen.

Example

The code is as follows:

$ Fp = fsockopen ($ host, 80, $ errno, $ errstr, 30 );

After the function is changed to stream_socket_client (), it should be as follows:
 
$ Fp = stream_socket_client ($ host. "80 & Prime;, $ errno, $ errstr, 30 );

Oh, if you don't have one, you don't have to find a way to estimate other ways. They also disable those functions, so we should change the space provider.

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.