Skip to content

Instantly share code, notes, and snippets.

@breekoy
Last active August 28, 2019 07:09
Show Gist options
  • Save breekoy/75a5379409d69f658f8c1117350bf12a to your computer and use it in GitHub Desktop.
Save breekoy/75a5379409d69f658f8c1117350bf12a to your computer and use it in GitHub Desktop.
install lumen micro-framework on windows server 2016
requirements
- IIS
- CGI for IIS
1. enable IIS and CGI for IIS
2. download and extract PHP
3. move the extracted PHP folder to C:\ and rename it to 'php'
4. Open the php.ini file and add the following line at the end of the file.
extension=wincache
5. Uncomment the following lines
fastcgi.impersonate = 1;
cgi.fix_pathinfo=1;
cgi.force_redirect = 1 (and change the value to 0, i.e. cgi.force_redirect = 0)
extension_dir = "C:\php\ext"
extension=curl
extension=mbstring
extension=pdo_mysql
extension=openssl
error_log = "C:\php\php_errors.log"
error_log = syslog
6. add C:\php\ to System Path
7. download WinCache (https://sourceforge.net/projects/wincache/files/development/)
8. copy php_wincache.dll to C:\php\ext
9. go to Server Manager -> Tools -> Internet Informations Services (IIS) Manager
10. double click on server name and double click on Handler Mappings
11. click 'Add Module Mapping' and add these values:
Request path: *.php
Module: FastCgiModule
Executable: "C:\php\php-cgi.exe"
Name: PHPCGI
Request Restrictions: File or folder
12. download and install Microsoft Visual C++ 2015 Redistributable Update 3 RC (vc_redist.x64.exe) [https://www.microsoft.com/en-us/download/details.aspx?id=52685]
13. Create phpinfo.php file with below content in the website folder and test the result.
<?php
phpinfo();
14. download and install Composer
15. download and install Git
16. clone project repo
17. open IIS manager, double click on the server and click view sites
18. right click and click add website...
19. input these values:
Site name: Project Site Name
Application pool: DefaultAppPool
Physical path: C:\inetpub\wwwroot\project_name\public
type: http
IP address: SERVER_IP_ADDRESS
port: 80
20. In File Explorer, right click on the storage folder in C:\inetpub\laravel and select Properties. Under the Security tab, grant full control of the storage folder to IUSR / IIS_IUSRS.
21. create a web.config file in C:\inetpub\laravel\public as follows:
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="default.aspx" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
<httpErrors errorMode="Detailed" />
</system.webServer>
</configuration>
22. download and install url-rewrite (https://www.iis.net/downloads/microsoft/url-rewrite)
23. restart iis:
iisreset /restart
24. start w3svc service:
net start w3svc
25. install composer packages:
composer install
26. set the .env file
congrats! you're all set!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment