stopblackholes Posted July 31, 2008 Share Posted July 31, 2008 Hello i have a few questions about PHP sockets and Shell Scripts. I found some great tutorials but they fail at explaining the obvious. Ok #!/usr/bin/php5 -q that tells the server its a shell script. do i need shell access to start a socket a server? if not how do i turn it on or shut it down? Does each client/user need to start the script? or is it just one background process that listens for people who connect? Link to comment https://forums.phpfreaks.com/topic/117468-solved-php-sockets-and-shell-script-help/ Share on other sites More sharing options...
Third_Degree Posted July 31, 2008 Share Posted July 31, 2008 Well if you are going to be constantly running the listening script, you will need shell/root access. A client will only need to start their side of the script (connecting to your server script). To turn it on/off just use the command line to call/stop the script. Curious, are you using socket_create or fsockopen? you might be asking the wrong question here. Link to comment https://forums.phpfreaks.com/topic/117468-solved-php-sockets-and-shell-script-help/#findComment-604249 Share on other sites More sharing options...
stopblackholes Posted July 31, 2008 Author Share Posted July 31, 2008 socket_create. Well i dont have root access on the server so that's going to be a problem. i wish there was some way to invoke it then kill the process every so often. Link to comment https://forums.phpfreaks.com/topic/117468-solved-php-sockets-and-shell-script-help/#findComment-604252 Share on other sites More sharing options...
Third_Degree Posted July 31, 2008 Share Posted July 31, 2008 Do you have access to cronjobs? Link to comment https://forums.phpfreaks.com/topic/117468-solved-php-sockets-and-shell-script-help/#findComment-604255 Share on other sites More sharing options...
stopblackholes Posted July 31, 2008 Author Share Posted July 31, 2008 yes i do. is it possible to kill the process? i guess i will have the script stop itself after awhile then have cron restart it probably. But that will be tricky. Link to comment https://forums.phpfreaks.com/topic/117468-solved-php-sockets-and-shell-script-help/#findComment-604258 Share on other sites More sharing options...
Third_Degree Posted July 31, 2008 Share Posted July 31, 2008 well you could just loop it say, a million times, but I'm not exactly sure if this would work like a regular socket shell script, you'd have to try it out. Link to comment https://forums.phpfreaks.com/topic/117468-solved-php-sockets-and-shell-script-help/#findComment-604262 Share on other sites More sharing options...
stopblackholes Posted July 31, 2008 Author Share Posted July 31, 2008 yeah ill give that a try i hope all goes well . thanks for the input! Link to comment https://forums.phpfreaks.com/topic/117468-solved-php-sockets-and-shell-script-help/#findComment-604265 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.