Last active
September 6, 2023 20:40
-
-
Save lukesampson/6546858 to your computer and use it in GitHub Desktop.
This file contains 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
write-host "checking..." | |
# check for apache | |
$apache = scoop which httpd | |
if($lastexitcode -ne 0) { 'Apache isn''t installed. run ''scoop install apache'''; return } | |
# check for php | |
$php = scoop which php | |
if($lastexitcode -ne 0) { 'PHP isn''t installed. run ''scoop install php'''; return } | |
$conf = "$(split-path $apache)/../conf/httpd.conf" | |
'enabling PHP handler...' | |
$phpmodule = "$(split-path $php -resolve)\php8apache2_4.dll" | |
if(test-path $phpmodule) { | |
$lines = gc $conf | |
$phpmodule = $phpmodule -replace '\\', '/' | |
" | |
# php setup | |
LoadModule php_module '$phpmodule' | |
AddHandler application/x-httpd-php .php | |
PHPIniDir `"$(split-path $phpmodule)`" | |
" | out-file $conf -append -encoding utf8 | |
} else { | |
"error: couldn't find $phpmodule"; return | |
} | |
"done" |
Please update to PHP8 - https://gist.githubusercontent.com/robinrehbein/129710351eec79d9dc7c391dc540b9f4/raw/f709fc4da0cfea16a13055b2b8a8dc2ffa70da46/apache-php-init.ps1
Had to change in httpd.conf LoadModule php7_ module to only LoadModule php_module for PHP8
For the Documentation:
iex (new-object net.webclient).downloadstring('https://gist.githubusercontent.com/robinrehbein/129710351eec79d9dc7c391dc540b9f4/raw/f709fc4da0cfea16a13055b2b8a8dc2ffa70da46/apache-php-init.ps1')
Thanks @robinrehbein, updated with your changes now.
Hi @lukesampson
The newer documentation at ...
https://github.com/ScoopInstaller/Scoop/wiki/Apache-with-PHP
... still has the older PHP7 url, which fails when run.
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please update to PHP7 - https://gist.github.com/nilkesede/39bf76daefb5721c1c83