1. Install PHP by using Web PI
The preferred method to install PHP on a Windows or Windows Server computer is to use Web Platform Installer (Web PI).
To install PHP by using Web PI
- Open a browser to the following website: Microsoft Web Platform Installer 3.0.
- Click Download It Now, and then click Run.
- At the top of the Web Platform Installer window, click Products.
- Click Frameworks, and then select the current version of PHP.
- Click Install. The Web Platform Installation page displays the version of PHP and its dependencies that will be installed.
- Click I Accept. Web PI installs the PHP packages.
- Click Finish.
2. Add Your copy of Shelly Portal to IIS
Once you have PHP installed, you can add a Shelly portal to your web server. This section describes how to set up your PHP application on an IIS web server with PHP installed.
To add a Shelly Portal
-
Open IIS Manager.
- For Windows Server 2012, on the Start page click the Server Manager tile, and then click OK. On the Server Manager Dashboard, click the Tools menu, and then click Internet Information Services (IIS) Manager.
- For Windows 8, on the Start page type Control Panel, and then click the Control Panel icon in the search results. On the Control Panel screen, click System and Security, click Administrative Tools, and then click Internet Information Services (IIS) Manager.
-
In the Connections pane, right-click the Sites node in the tree, and then click Add Website.
-
In the Add Website dialog box, type a friendly name for your website in the Site name box.
-
If you want to select a different application pool than the one listed in the Application Pool box, click Select. In the Select Application Pool dialog box, select an application pool from the Application Pool list and then click OK.
-
In the Physical path box, type the physical path of the Shelly Portal folder, or click the browse button (...) to navigate the file system to find the folder.
-
If the physical path that you entered in step 5 is to a remote share, click Connect as to specify credentials that have permission to access the path. If you do not use specific credentials, select the Application user (pass-through authentication) option in the Connect As dialog box.
-
Select the protocol for the website from the Type list.
-
The default value in the IP address box is All Unassigned. If you must specify a static IP address for the website, type the IP address in the IP address box.
-
Type a port number in the Port text box.
-
Optionally, type a host header name for the website in the Host Header box.
-
If you do not have to make any changes to the site, and you want the website to be immediately available, select the Start Web site immediately check box.
-
Click OK.
3. Configure WinCache
WinCache is a PHP extension that accelerates PHP applications, which run on Windows and Windows Server. For the most installations, the WinCache extension must be added to the php.ini file and no other configuration is required. However, if you want more control, WinCache offers many configuration settings. You can see a full list of setting in the WinCache Runtime Configuration page.
To configure the WinCache PHP extension
- In Windows Explorer, open your PHP installation folder, for example
C:\PHP
. - Choose either the php.ini - development or php.ini - production file, and rename it php.ini.
- In a text editor, open the php.ini file and added the following line at the end of the file:
extension = php_wincache.dll
. - Save and close the php.ini file.
- Recycle the IIS Application Pools for PHP to pick up the configuration changes.
To view WinCache configuration and other PHP settings
-
Open a text editor.
-
In a new file, type the following text:
-
Save the file as
c:\inetpub\wwwroot\phpinfo.php
. -
Open a browser and enter the following URL:
http://localhost/phpinfo.php
A nicely formatted web page is displayed showing the current PHP settings. The WinCache settings appear in a section called wincache.
Warning: Delete the phpinfo.php file when it's no longer needed.
4. Other PHP Settings
Configuration and environmental settings for PHP are contained within the Php.ini, which is located in the PHP folder that you create during installation, for example C:\PHP
. The following sections contain a number of settings for the Php.ini file that help PHP work better with Windows.
Required Settings
- extension_dir =
: The extension_dir points to the directory where the PHP extensions are stored. The path can be fully qualified (for example, C:\PHP\ext
) or relative (for example, .\ext). Extensions that are specified lower in the Php.ini file are located in the extension_dir. If the extensions specified are not in the extension_dir, then PHP displays a warning message at the start of script execution, and the application may show errors because of the missing functionality. - extension = xxxxxx.dll: For each extension enabled, a corresponding extension= directive that tells PHP which extensions in the extension_dir to load at startup time is necessary.
- log_errors = On: PHP errors can also go through the PHP error logging facility. This can be used to send errors to a file or to a service (for example, syslog) and works with the error_log directive described below. When running under IIS, log_errors must be enabled with a valid error_log. Otherwise, FastCGI considers any startup
- error_log =
: The error_log must specify the fully qualified, or relative, path to the file where the PHP error log is stored. This file must be writable for the IIS service. The most common places for this file are in various temporary directories (for example, C:\inetpub\temp\php-errors.log
). That puts the log in a place that IIS can use and keeps the log close to where PHP applications are running. - cgi.force_redirect = 0: This directive is required for running under IIS. It is a directory security facility that is required by many other web servers. However, enabling it under IIS causes the PHP engine to fail on Windows.
- cgi.fix_pathinfo = 1: This setting lets PHP access real path information per the CGI specification. The IIS FastCGI implementation needs this extension set.
- fastcgi.impersonate = 1: FastCGI under IIS supports the ability to impersonate security tokens of the calling client. This setting allows IIS to define the security context that the request runs under.
- fastcgi.logging = 0: FastCGI logging should be disabled when you use PHP with IIS. If it is left enabled, then any messages of any class are treated by FastCGI as error conditions, which causes IIS to generate an HTTP 500 exception.
Optional Settings
- max_execution_time = ##: This directive sets the maximum amount of time that can be taken executing any given script. The default is 30 seconds. Some applications need more time to process batch operations (for example, Gallery2 loading multiple images from a remote location). However, setting the execution time higher than 300 seconds is not advised because there are often other parts of the connection that cannot support such a long execution time.
- memory_limit = ###M: The amount of memory available for the PHP process (in MB). The default is 128 MB, which is sufficient for most PHP applications.
- display_errors = Off: This directive determines whether to include any error messages in the stream that it returns to the web server. If turned on, PHP sends the classes of errors that are defined with the error_reporting directive back to IIS as part of the error stream. Many of the open-source applications bypass error reporting by executing commands prefaced with @. This setting allows the applications to control error handling.
- Mail functions: PHP is configured by default to send outbound mail through an SMTP server that is located on the same system as the web server. Most Windows installations usually have the web and mail servers on separate systems.
5. Oracle PHP extension
You need to enable Oracle PHP extension if you use Shelly Portal with Oracle database.
To configure the Oracle PHP extension
- In Windows Explorer, open your PHP installation folder, for example
C:\PHP
. - Choose either the php.ini - development or php.ini - production file, and rename it php.ini.
- In a text editor, open the php.ini file and added the following line at the end of the file:
extension=php_oci8_12c.dll
- Save and close the php.ini file.
- Recycle the IIS Application Pools for PHP to pick up the configuration changes.