-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdw_php_installer.bat
More file actions
68 lines (56 loc) · 2.69 KB
/
Copy pathdw_php_installer.bat
File metadata and controls
68 lines (56 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@echo off
SETLOCAL EnableDelayedExpansion
:: --- CONFIGURATION ---
set PHP_VER=8.2.12
set INSTALL_DIR=%CD%\php_runtime
set PHP_ZIP=php-runtime-x86.zip
set DOWNLOAD_URL=https://windows.php.net/downloads/releases/archives/php-%PHP_VER%-Win32-vs16-x86.zip
set STARTUP_LNK=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\LaunchDashboards.bat
set RESTART_BAT=%CD%\start_server.bat
echo ====================================================
echo DELMIAWorks w/PHP - x86 Setup
echo ====================================================
:: 1. Create Runtime Folder
if not exist "%INSTALL_DIR%" mkdir "%INSTALL_DIR%"
:: 2. Download 32-bit PHP
if not exist "%INSTALL_DIR%\php.exe" (
echo [1/6] Downloading x86 PHP %PHP_VER%...
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%DOWNLOAD_URL%' -OutFile '%PHP_ZIP%'"
echo [2/6] Extracting files...
powershell -Command "Expand-Archive -Path '%PHP_ZIP%' -DestinationPath '%INSTALL_DIR%' -Force"
del %PHP_ZIP%
)
:: 3. Configure PHP for Oracle 19 (x86)
echo [3/6] Enabling OCI8 Extension...
cd /d "%INSTALL_DIR%"
copy php.ini-development php.ini >nul
echo extension_dir = "ext" >> php.ini
echo extension=php_oci8_19.dll >> php.ini
:: 4. Create "Start on Boot" Launcher
echo [4/6] Creating Startup Launcher...
echo @echo off > "%STARTUP_LNK%"
echo cd /d "%CD%\.." >> "%STARTUP_LNK%"
echo "%INSTALL_DIR%\php.exe" -S 0.0.0.0:8080 -t "%CD%\..\public" "%CD%\..\public\index.php" >> "%STARTUP_LNK%"
:: 5. Create Local "Run Server" Script
echo [5/6] Creating local run script...
echo @echo off > "%RESTART_BAT%"
echo title DELMIAWorks PHP Server >> "%RESTART_BAT%"
echo cd /d "%%~dp0" >> "%RESTART_BAT%"
echo echo Starting Server... >> "%RESTART_BAT%"
echo "%INSTALL_DIR%\php.exe" -S 0.0.0.0:8080 -t "public" "public\index.php" >> "%RESTART_BAT%"
:: 6. Firewall Rule
echo [6/6] Opening Firewall Port 8080...
netsh advfirewall firewall add rule name="DELMIAWorks PHP Server" dir=in action=allow protocol=TCP localport=8080 >nul 2>&1
echo ====================================================
echo SETUP COMPLETE!
echo.
echo NOTE: THIS WINDOW MUST REMAIN OPEN (MINIMIZED).
echo If closed, run 'start_server.bat' to restart.
echo ====================================================
:: Get the Local IP Address
for /f "delims=" %%i in ('powershell -Command "(Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.InterfaceAlias -notlike '*Loopback*' -and $_.IPAddress -notlike '169.254.*' } | Select-Object -First 1).IPAddress"') do set LOCAL_IP=%%i
echo.
echo Access your dashboard at: http://%LOCAL_IP%:8080/schedule
echo.
"%INSTALL_DIR%\php.exe" -S 0.0.0.0:8080 -t "%CD%\..\public" "%CD%\..\public\index.php"
pause