govtcheeze Posted January 5, 2007 Share Posted January 5, 2007 I have a socket listener up and running. From inside flash I can send the message "/SERVER hi test" and it gets broadcast.I have a test file:[code]<?phpserverMessage("/SERVER test message");function serverMessage($buf) { if(DEBUG_HASH) { logDebug("entering function <b>serverMessage</b> in sockTest.php: buf: [$buf]"); } $ip = "myIP"; // my real IP is in the file $port = myPort; // my real port is in the file $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if(DEBUG_HASH) { logDebug("socket: [$socket]"); } //socket_set_nonblock($socket); socket_connect($socket, $ip, $port); if(DEBUG_HASH) { logDebug("results: [" . socket_strerror(socket_last_error()) . "]"); } //socket_set_block($socket); $results = socket_write($socket, $buf); if(DEBUG_HASH) { logDebug("results: [" . socket_strerror(socket_last_error()) . "]"); } socket_shutdown($socket, 2); socket_close($socket); if(DEBUG_HASH) { logDebug("exiting function serverMessage"); }}?>[/code]When I run it from shell, it parses the message and outputs to proper text to connected users.When I call this function from within a php file that runs as a web page [code=php:0]serverMessage("/SERVER test message"); [/code] I get the following error log (bolded red is the permission issue):2007-01-04 23:26:26 -- entering function serverMessage in sockTest.php: buf: [/SERVER test message]2007-01-04 23:26:26 -- socket: [Resource id #42][color=red][b]2007-01-04 23:26:26 -- results: [Permission denied][/b][/color]2007-01-04 23:26:26 -- results: [Broken pipe]2007-01-04 23:26:26 -- exiting function serverMessageAny ideas why I can't connect from within the web based PHP script but I Can when connected to shell? Looks like some sort of perm issue, but many searches on google turned up no data I found to help resolve this issue.I have also tried to call a test file that sets posix_userid to a user and does a shell execute of the above file. When I run that from shell it works fine, but when I run from a web browser the posix_setui() returned error is "Operation not permitted".Help please :D Link to comment https://forums.phpfreaks.com/topic/32992-solved-socket_connect-permission-denied/ Share on other sites More sharing options...
govtcheeze Posted January 5, 2007 Author Share Posted January 5, 2007 HA! SELinux was causing the problem ... a couple tweaks to the settings fixed it right up. ;D Link to comment https://forums.phpfreaks.com/topic/32992-solved-socket_connect-permission-denied/#findComment-153797 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.