Solution: PHPsocket problems

Source: Internet
Author: User
Solution: for PHPsocket problems, the following test code shows that the environment I set up locally with appserv is correctly executed. You can also use a client to connect to and execute the command.
 


However, after I put it on the vps, it shows that the port is opened and cannot be opened again (when the script is executed the second time, an error message is returned, and the port is occupied ). I scanned the port and found that Port 9999 is indeed an open UDP port, but the client cannot complete the communication (maybe it cannot be sent or received, who knows ...)

The following is the result of phpinfo, indicating that socket support is enabled. (Too long, the socket found after ctr + f is here)
Configure Command './configure' '--prefix=/usr/local/php5' '--enable-force-cgi-redirect' '--enable-fastcgi' '--with-config-file-path=/usr/local/etc/php5/cgi' '--with-curl=/usr/local/lib' '--with-gd' '--with-gettext' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' '--with-kerberos' '--with-openssl' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--with-pcre-regex=/usr/local' '--with-pdo-mysql=/usr' '--with-pear' '--with-png-dir=/usr/local/lib' '--with-xsl' '--with-zlib' '--with-zlib-dir=/usr/local/lib' '--enable-zip' '--enable-gd-native-ttf' '--with-iconv=/usr/local' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-mbstring'

Registered Stream Socket Transportstcp, udp, unix, udg, ssl, sslv3, sslv2, tls

socketsSockets Supportenabled

default_socket_timeout6060


Well, who has experience? thank you ~


Reply to discussion (solution)

Change the port number

The opened Port cannot be opened again.

I manually changed localhost to the server IP address, and added set_time_limit (2 );

The execution result is the same as above. The scan shows that the port is opened, but the client cannot communicate.

However, I soon saw this:

The server encountered an internal error or misconfiguration and was unable to complete your request


Change the port number

The opened Port cannot be opened again.
Well, there is a change every time.

The server encountered an internal error or misconfiguration and was unable to complete your request
The server encounters an internal error or configuration error and cannot complete your request.

The server encountered an internal error or misconfiguration and was unable to complete your request
The server encounters an internal error or configuration error and cannot complete your request.

Are there any suggestions? For example, query the log or how to try it?

Look at the firewall or something.

9999 is an opened port, right? but do you have port 9999 that is occupied by no other program? if it is not occupied by other programs, you may consider setting a firewall.

Otherwise, use a new port or close the program that uses port 9999.
You can also change the program to another port.

In short, a port can only be mapped to one program.

Well, the last attempt was fruitless, and the firewall on the VPS could not work. That's it.

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.