Windows
Note: For the most up-to-date installation instructions please reference our guide found here.
Installing Dreamfactory on Windows Server 2012R2, Server 2016, Windows 10 with IIS8+
Note: These installation instructions assume a “Clean Install” for IIS. There may be sections which have already been accomplished or installed. If so, skip the sections which no longer apply to your situation. These instructions are concerned only with the installation of DreamFactory. Please consult your Windows Administrator for hardening the web server and other security controls which are outside the scope of these instructions.
Install PHP for IIS
Before beginning the installation download the Web Platform Installer for IIS here.
- In the Web Platform Installer, navigate to the Products tab and choose Frameworks from the sidebar. Select the appropriate PHP version. In our example, we're using PHP 7.1.1 (x64).
- Click Add, then Install at the bottom. Follow the on screen prompts to accept the EULA to install PHP for IIS.
Setup PHP Module Mapping in IIS 8 (If Needed)
Once PHP has been successfully installed, it must be set up in IIS8.
- Open the IIS Services Manager and from the sidebar, click the server name.
- Double-click Handler Mappings. PHP needs to be associated with the FastCGI handler in your PHP directory.
Note:If PHP was installed using the Web Platform Installer the handler mappings should have the FastCGI associations already. Check that the associations are correct and correspond to your local server.In the list of handler mappings the name of the mapping defaults to PHP_via_FastCGI,this is the mapping you will need to doublecheck. Click OK.
If the default handler mapping for PHP FastCGI isn't listed you will need to add it now:
- From the Actions pane, click Add Module Mapping Enter the following information with the path to the php-cgi executable local to the server:
Request Path: | *.php |
Module: | FastCgiModule |
Executable: | "C:\Program Files\PHP\v7.1\php-cgi.exe" |
Name: | PHPviaFastCGI |
- Click OK, then click Yes to confirm.
- Using Internet Information Services (IIS) Manager click on the server you are working with and click Restart from the actions pane.
Test PHP for IIS
To test PHP, we are going to create a php info file within the web root directory. Typically, this directory is located in:
C:\inetpub\wwwroot
- In the webroot directory, create an empty PHP file. At the top of file the type the following:
<?php phpinfo();
- Save the file as info.php. Ensure the filename and extension are info.php, not info.php.txt. This would be not shown if Hide Extensions for known file types is enabled from Folder Options. Make sure this is unchecked, if need be from Folder Options:
- From a browser, navigate to the phpinfo file you just created. Typically, on a fresh server install it will be http://localhost/info.php in your web browser.
- If you receive a 404.0 error, typically the problem is either that the extension is not .php or that file permissions are set incorrectly. If you receive a 403.3 error with the following message, MIME types must be set up correctly for PHP, please ensure that you followed the IIS PHP setup section above. If you are seeing a blank page, you may need to enable errors for debugging purposes in your php.ini file. Alternately, you can view the output of the php error.log for more info.
- If the install was successful, you should see a PHP Info page in your browser. Keep this file in place until you finish the rest of the configuration, then delete it afterwards, as this file contains system-specific information.
Once you have PHP set up and working with IIS, you are ready to install Dreamfactory and add it as a site in IIS 8.
Install Dreamfactory on IIS 8
You will need to follow the Required Software and Extensions section to ensure you have Git, Composer, and optionally the MongoDB Driver, if needed. After completing that, the following describes how to install Dreamfactory on IIS8.
Note: We will be using SQL Server as an external service database for DreamFactory. If you haven't already, you will need to purchase a Dreamfactory subscription before installing, so the appropriate dependencies can be added to your installation. Please contact Support for additional information. If you decide to not upgrade, you can still install this by skipping the df:env
command and go straight to the df:setup
command. This will create an SQLite database as your system database (which is the default in all of our GitHub installs).
- Next, open a command prompt, Power Shell, or Windows Git Client
- From the prompt, navigate to the directory you want to install Dreamfactory. Typically, this will be:
C:\inetpub\wwwroot\
However you can choose any location you want. We will add this as a site later in IIS. In this example, we're choosing:
C:\inetpub\wwwroot\dreamfactory
- Perform a Git clone into this directory for Dreamfactory:
git clone https://github.com/dreamfactorysoftware/dreamfactory
This will pull down the master branch of Dreamfactory into a directory called ./dreamfactory
.
- Navigate to the dreamfactory directory and install dependencies using composer. For production environment, use --no-dev, otherwise discard that option for a development environment. If you are not running or plan to run MongoDB, add
—ignore-platform-reqs
:
composer update --ignore-platform-reqs --no-dev
Otherwise run the following command to install the dependencies:
composer install --no-dev
Run DreamFactory setup command-line wizard. This will set up your configuration and prompt you for things like database settings, first admin user account, etc. It will also allow you to change environment settings midway and then run it again to complete the setup.
- As with our other installs, the first command lets you choose and configure your system database (SQLite, MySQL, PostgreSQL, or MSSQL). You can also change the environmental settings here.:
php artisan df:env
- The second command enables you to finish the configuration, adding your first admin account, etc.
php artisan df:setup
Follow the on-screen prompts to complete the setup.
Add Dreamfactory Site to IIS Manager
- Open IIS Manager
- From the Actions column, select Add Web Site
- Enter in all pertinent information in the dialog. In the Physical Path field, enter the path to your Dreamfactory installation's public folder.
- Enter your Host name as well for your instance.
- Click OK to start the service.
Ensure Dreamfactory Cache and Log Directories are Writable
You will need to set permissions on the following directories to ensure they are writable within the Dreamfactory installation folder. These are:
- storage/framework/cache/
- storage/framework/views/
- storage/logs/
Please ensure that the Users group has full control of these directories to enable creation of log files, cache files, etc. Optionally, if you are using the included sqlite database for testing, please ensure the storage/databases/ directory also has write and modify permissions as well.
Restart your web server and navigate to your Dreamfactory installation. If you are testing in the local environment, you can add a FQDN in your hosts file to allow navigating to the Dreamfactory site locally.
Add Verb Handlers to Application Host Config
FastCGI for IIS8 by default has several key HTTP Verbs missing which need to be enabled before running DreamFactory.
To add them, edit the file located in:
C:\Windows\System32\inetsrv\config\applicationHost.config
Find the <handlers> section and add all the missing verbs to the FastCGI PHP sections. I.e.,
<handlers accessPolicy="Read, Script"> <add name="PHPviaFastCGI2" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files\PHP\v7.1\php-cgi.exe" resourceType="File" /> <add name="PHP_via_FastCGI" path="*.php" verb="GET,HEAD,POST,DELETE,PUT,PATCH" modules="FastCgiModule" scriptProcessor="C:\Program Files\PHP\v7.1\php-cgi.exe" resourceType="Either" /> <add name="PHP53_via_FastCGI" path="*.php" verb="GET,HEAD,POST,DELETE,PUT,PATCH" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.3\php-cgi.exe" resourceType="Either" /> <add name="CGI-exe" path="*.exe" verb="*" modules="CgiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" /> <add name="TRACEVerbHandler" path="*" verb="TRACE" modules="ProtocolSupportModule" requireAccess="None" /> <add name="OPTIONSVerbHandler" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" /> <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" /> </handlers>
- Once you have made the modifications, save the file and navigate back to the Internet Information Services (IIS) Manager.
- Select Request Filtering from the list of choices for the DreamFactory site you set up earlier.
- From the dialog, fill in the missing verbs that you added to the <handlers> section. Add an entry for each verb.
- Double check your
web.config
is correct:
<configuration> <system.webServer> <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> <security> <requestFiltering> <verbs> <add verb="GET" allowed="true" /> <add verb="PATCH" allowed="true" /> <add verb="PUT" allowed="true" /> <add verb="DELETE" allowed="true" /> <add verb="POST" allowed="true" /> </verbs> </requestFiltering> </security> </system.webServer> </configuration>
- Once you have finished, restart IIS.