FAQ - WebSocket - Protect PHP Daemon

WebSocket - Protect PHP Daemon

3139


When running a PHP Dameon it is important that it will be run only thru CLI (ssh, command line) and never from a browser (security risk).

You have two options to protect the files from accessing from a browser.

1. Your server is running on Apache

Create a .htaccess file and place it inside the server directory with following content

deny from all

or and that works for all solutions, place the server directory outside the web directory. If you do so, you need to change the path inside the files so it will find the database informations and config files.

For that open server/websockets.php and change the path in following code

$socket_url = dirname(__file__) . DIRECTORY_SEPARATOR;
$final_url = str_replace("/server", "", $socket_url);

Done.