PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Is var_dump($socket) being called from stop.php? Are you sure that stop.php is being included into a context from which $socket is accessible?
Also, PHP will close all open MySQL connection at the end of the script, so it might not be necessary for you to close the connection with mysql_close.
Well I'm still not sure what the problem was, but I took your advice and just let php close mysql connections itself, and it works fine. Thanks for the help!