Trying to setup a container to run a PHP application version 5.3. The required webserver is IIS and when I run the following container interactively I receive the following lines of errors:
Service 'w3svc' has been stopped
APPCMD failed with error code 4312
Failed to update IIS configuration
Any suggestions are appreciated, thanks in advance.
The Dockerfile is below:
# PHP 5.3 x86 running on IIS
FROM microsoft/iis AS php53
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
RUN
try {
# Install PHP
Invoke-WebRequest 'https://sourceforge.net/projects/phpinstallermsi/files/zip/php-5.3.28-nts-Win32-VC9-x86.zip/download' -UserAgent '' -OutFile C:\php.zip;
Expand-Archive -Path c:\php.zip -DestinationPath C:\PHP;
Invoke-WebRequest 'https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe' -UserAgent '' -OutFile C:\vc_redist-x64.exe;
Invoke-WebRequest 'https://sourceforge.net/projects/wincache/files/wincache-1.3.7/wincachewpi-1.3.7.12-5.3-nts-vc9-x86.exe/download' -UserAgent '' -OutFile C:\php_wincache.exe;
# Install PHP Win Cache
C:\php_wincache.exe /Q /C "/T:C:\php_wincache_msi";
Start-Process -FilePath msiexec -ArgumentList '/a C:\php_wincache_msi\wincache53wpi.msi /qb TARGETDIR=C:\php_wincache_msi\extracted' -NoNewWindow -PassThru -Wait;
Copy-Item C:\php_wincache_msi\extracted\PFiles\php_wincache.dll c:\PHP\ext;
# Configure PHP
Copy-Item C:\PHP\php.ini-production C:\PHP\php.ini;
}
catch {
$.Exception;
$;
exit 1;
}
FROM microsoft/iis
COPY --from=php53 ["/php/", "/php/"]
COPY --from=php53 ["/vc_redist-x64.exe", "/vc_redist-x64.exe"]
# Enable required IIS Features
# Install VC Redist 14
# Configure IIS
# Configure system PATH
RUN dism.exe /Online /Enable-Feature /FeatureName:IIS-CGI /All &&
C:\vc_redist-x64.exe /quiet /install &&
del C:\vc_redist-x64.exe &&
%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/fastCgi /+[fullPath='c:\PHP\php-cgi.exe'] &&
%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='.php',verb='',modules='FastCgiModule',scriptProcessor='c:\PHP\php-cgi.exe',resourceType='Either'] &&
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /[fullPath='c:\PHP\php-cgi.exe'].instanceMaxRequests:10000 &&
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+[fullPath='c:\PHP\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000'] &&
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+[fullPath='c:\PHP\php-cgi.exe'].environmentVariables.[name='PHPRC',value='C:\PHP'] &&
setx PATH /M %PATH%;C:\PHP &&
setx PHP /M "C:\PHP"
# Optional: Add a starter page
RUN powershell.exe -Command "'<?php phpinfo(); ?>' | Out-File C:\inetpub\wwwroot\phpinfo.php" -Encoding UTF8
# ADD any application content and perform any configuration below
WORKDIR /inetpub/wwwroot
COPY /ctsb .
EXPOSE 80
EXPOSE 443