- 1 Installing Dreamfactory on Windows Server 2008 with IIS7
Installing Dreamfactory on Windows Server 2008 with IIS7
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 5.6.
- 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
Once PHP has been successfully installed, it must be set up in IIS7.
- 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:
- 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:
- In the webroot directory, create an empty PHP file. At the top of file the type the following:
- 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 7.
Install Dreamfactory on IIS 7
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 IIS7.
Note:If you plan on running SQL Server with Dreamfactory,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.
- 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:
However you can choose any location you want. We will add this as a site later in IIS. In this example, we're choosing:
- 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 set up.
- Note: Previously this command was
df:setup. As of DF 2.7.0 the command is changed to
- to set up the db connection
$ php artisan df:env
- to set up the tables and the admin user in the db.
$ 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.
Add URL Rewrite Rules to IIS
You will need to add rewrite rules to IIS 7 manually. To accomplish this follow the below steps:
- Click on the Dreamfactory site and then choose URL Rewrite.
- From the Actions column, choose Import Rules.
- Navigate to the .htaccess file in the /public directory of your Dreamfactory installation in the Configuration File input, then click Import. The .htaccess file will automatically be converted to XML for you.
- In Tree View, find any rules that have a red X icon. Click on that rule and it will be highlighted in the Rewrite Rules dialog box.
- Remove that rule in the Rewrite Rules dialog box and repeat this for any additional rules until you see all green checkboxes.
- Click Apply in the Actions column.
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:
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.