Created
November 17, 2025 08:25
-
-
Save JBlond/2d6b9fd5269788645f29565d827bc266 to your computer and use it in GitHub Desktop.
PowerShell Setup-Skript für Composer & PHP mit Zscaler-Zertifikat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # PowerShell Setup-Skript für Composer & PHP mit Zscaler-Zertifikat | |
| $phpIniPath = "C:\php83\php.ini" | |
| $cacertPath = "C:\php83\cacert.pem" | |
| $zscalerCertPath = "C:\php83\zscaler-root.pem" | |
| $composerConfigCmd = "composer config --global cafile $cacertPath" | |
| Write-Host "📥 Lade aktuelle cacert.pem herunter..." | |
| Invoke-WebRequest -Uri "https://curl.se/ca/cacert.pem" -OutFile $cacertPath | |
| if (Test-Path $zscalerCertPath) { | |
| Write-Host "🔐 Füge Zscaler-Zertifikat zur cacert.pem hinzu..." | |
| Get-Content $zscalerCertPath | Add-Content $cacertPath | |
| } else { | |
| Write-Host "⚠️ Zscaler-Zertifikat nicht gefunden unter $zscalerCertPath" | |
| } | |
| Write-Host "🛠️ Aktualisiere php.ini..." | |
| (Get-Content $phpIniPath) -replace '^(curl\.cainfo\s*=.*)$', "curl.cainfo = `"$cacertPath`"" ` | |
| -replace '^(openssl\.cafile\s*=.*)$', "openssl.cafile = `"$cacertPath`"" | | |
| Set-Content $phpIniPath | |
| # Falls Einträge fehlen, ergänzen | |
| $content = Get-Content $phpIniPath | |
| if (-not ($content -match "curl.cainfo")) { | |
| Add-Content $phpIniPath "`ncurl.cainfo = `"$cacertPath`"" | |
| } | |
| if (-not ($content -match "openssl.cafile")) { | |
| Add-Content $phpIniPath "`nopenssl.cafile = `"$cacertPath`"" | |
| } | |
| Write-Host "🔧 Konfiguriere Composer..." | |
| Invoke-Expression $composerConfigCmd | |
| Write-Host "🧪 Starte Composer Diagnose..." | |
| composer diagnose -vvv | Out-File "composer-diagnose.log" | |
| Write-Host "✅ Fertig. Ergebnis in composer-diagnose.log gespeichert." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment