File tree 5 files changed +23
-12
lines changed
5 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -450,7 +450,7 @@ document.addEventListener('keydown', ev => {
450
450
}
451
451
} )
452
452
453
- const host = 'ws://0 .0.0.0 :8009/websockets.php'
453
+ const host = 'ws://127 .0.0.1 :8009/websockets.php'
454
454
const socket = new WebSocket ( host )
455
455
456
456
// Event handler bindings
Original file line number Diff line number Diff line change 1
1
@ echo off
2
+ :: echo Starting local Dungeon Master Player server...
2
3
:: start servers
3
- start /B php -S localhost:8008 -q
4
- start /B php websockets.php -q
4
+ start /B " " php -S localhost:8008 -c php.ini -q > NUL 2 >& 1
5
+ start /B " " php -f ./websockets.php -c php.ini -q > NUL 2 >& 1
6
+
5
7
6
8
:: Open default browser
7
9
start http://localhost:8008
@@ -11,8 +13,7 @@ start http://localhost:8008
11
13
timeout /T 1 > nul
12
14
if exist " stopserver" (
13
15
del stopserver
14
- taskkill /F /IM " php websockets.php -q"
15
- taskkill /F /IM " php -S localhost:8008 -q"
16
+ taskkill /F /IM php.exe > nul 2 >& 1
16
17
exit /B
17
18
)
18
19
goto loop
Original file line number Diff line number Diff line change @@ -6,21 +6,31 @@ set "phpDownloadUrl=https://windows.php.net/downloads/releases/latest/php-8.2-nt
6
6
set " phpZipFile = php.zip"
7
7
set " phpExtractDir = php"
8
8
9
+ REM Check if PHP folder exists and delete it
10
+ if exist " %phpExtractDir% " (
11
+ echo Deleting existing PHP folder...
12
+ rmdir /S /Q " %phpExtractDir% "
13
+ )
14
+
15
+ REM Get the current script directory
16
+ for %%I in (" %~dp0 " ) do set " scriptDir = %%~fI "
17
+
9
18
REM Download PHP
10
19
echo Downloading PHP...
11
- powershell -Command " (New-Object System.Net.WebClient).DownloadFile( '%phpDownloadUrl% ', ' % phpZipFile% ') "
20
+ powershell -Command " Invoke-WebRequest -Uri '%phpDownloadUrl% ' -OutFile ' %scriptDir% \ % phpZipFile% '"
12
21
13
22
REM Extract PHP
14
23
echo Extracting PHP...
15
- powershell -Command " Expand-Archive -Path '%phpZipFile% ' -DestinationPath '%phpExtractDir% ' -Force"
24
+ powershell -Command " Expand-Archive -Path '%scriptDir% \ % phpZipFile% ' -DestinationPath '%scriptDir% \ %phpExtractDir% ' -Force"
16
25
17
26
REM Add PHP directory to PATH
18
27
echo Adding PHP directory to PATH...
19
- setx PATH " %cd% \%phpExtractDir% \;%PATH% " /M
28
+ set " phpPath = %scriptDir%%phpExtractDir% "
29
+ setx PATH " %phpPath% ;%PATH% " /M
20
30
21
31
REM Cleanup
22
32
echo Cleanup...
23
- del " %phpZipFile% "
33
+ del " %scriptDir% \ % phpZipFile%"
24
34
25
35
echo PHP installation completed.
26
36
Original file line number Diff line number Diff line change @@ -23,9 +23,9 @@ On Windows, use dmplayer.bat (coming soon)<br>
23
23
On Linux and MacOS, use dmplayer.sh
24
24
25
25
### Install PHP (windows):
26
- Running install-php.bat will take care of it. (coming soon)
26
+ Running install-php.bat will take care of it. Right click and "Run as administrator".
27
27
28
- If you're more technically inclined, you can instead do this :
28
+ If you'd rather do it manually :
29
29
- Download the most recent <a href =" https://windows.php.net/download " >php</a > zip-file
30
30
- Unzip anywhere, but remember the directory
31
31
- <a href =" https://www.computerhope.com/issues/ch000549.htm " >Add that directory to PATH</a >
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- $ address = '0 .0.0.0 ' ;
3
+ $ address = '127 .0.0.1 ' ;
4
4
$ port = 8009 ;
5
5
6
6
// Create WebSocket.
You can’t perform that action at this time.
0 commit comments