Configuration and Settings of PhpDock
PhpDock's settings are contained in a single file, named PhpDock.ini. PhpDock installation program places PhpDock.ini in the top level directory of PhpDock. The following section of this manual described various types of configurations and settings available in PhpDock.
Error Handlers
PhpDock allows you to specify error handlers. If for example Application produces
HTTP/404 File Not Found error, PhpDock can be configured to display pre-defined page or run pre-defined
script. Latter one gets additional information about the error, such as URL,
Filename and Error code. All errors starting with code 400 can be handled this
way.
Backround jobs
PhpDock allows you to specify scripts to be run in background. It's a useful
feature for such tasks as online updates.
Mime Types
Handling of files depends on their Mime types. PhpDock supports about approx 140 file extensions and their mime types. These types can be changed so for example CSS will be handled as PHP if its type is changed from text/css to application/x-httpd-php.
PhpDock.ini file
All PhpDock settings are stored in one ini file. Windows registry is not used.
Syntax is similar to all ini files, such as php.ini. Comment lines must start with semicolon (;).
Section names are enclosed in square brackets. Settings are presented as Name=Value pairs, beginning with the Name, followed by "equal" sign and then by the Value.
PhpDock.ini file contains the following sections: [Application], [Window], [HTTPServer], [HTTPClient], [MimeTypes], [Handlers], [ErrorHandlers], [Jobs], [JobCtl]. The settings in PhpDock.ini directives can refer to one another by using the following syntax: ${Section:Name}. For Example, the expression ${HTTPServer:Listen} will be substituted by PhpDock with the value of List setting from [HTTPServer] section.
Below is the sample of the content of PhpDock.ini file with the description of the sections and the settings. This PhpDock.ini is installed by PhpDock's installation program and configured for PhpDock's Sample Application. Most of the settings are self-explanatory.
; Application section allows to specify Application title. The title is shown in
; Windows Task Bar.
; NOTE: caption of the main window displays current document title. Use <title>
; tag to specify it.
; NOTE: if favicon.ico is found in the web's root directory, it is displayed as
; the main window icon.
; NOTE: application's icon displayed in the Task Bar can not be changed and
; always set to display PhpDock.
[Application]
Title=PhpDock Currency Converter
; Window section stores only dimensions and position of the PhpDock window.
[Window]
IsMaximized=0
Left=64
Top=7
Height=891
Width=1107
; HTTPServer section stores settings related to HTTP server.
; DocumentRoot is relative or absolute path to web root directory tree.
; Listen specifies TCP/IP port to start listening on.
; NOTE PhpDock will change port value automatically if specified port is in use
; DirectoryIndex specifies file name(s) to be used if URL refers to directory.
; If more than one file is specified, PhpDock will iterate one by one until it
; finds a file
[HTTPServer]
DocumentRoot=web
Listen=8001
DirectoryIndex=index.php index.html
; HTTPClient section stores settings related to Web Browser.
; InitialUrl specifies where to jump first. This value should contain TCP port
; and therefore it's necessary to refer to its value ${HTTPServer:Listen},
; where HTTPServer is ini section and Listen is value.
; BlockPopups when set to non zero value disables popups.
[HTTPClient]
InitialUrl=http://localhost:${HTTPServer:Listen}/index.php
BlockPopups=0
; MimeTypes section may contain application specific mime types and these
; values override default table known to PhpDock. Use file extension as name
; and mime type as value.
; In order to run php, one entry should be specified, it's php file extension.
[MimeTypes]
.php=application/x-httpd-php
; Handlers section allows to assign script handlers for specified mime types
; In order to run php, one entry should be given, it's php's mime type
[Handlers]
application/x-httpd-php="C:\Program Files\nusphere\PhpDock\php5\php-cgi.exe"
; ErrorHandlers allows to specify default pages to be shown or scripts to be
; run if HTTP error is occured
; with current request.
[ErrorHandlers]
404=web/404.php
; Jobs section contains list of URL to be opened in background.
; All entries are executed one by one sequentially. If an error happens during
; opening the URL, PhpDock tries to run the job 2 more times. Status codes, Urls and
; outputs returned by each job are available in form of JOB_OUTPUT_x, JOB_URL_x
; and JOB_CODE_x environment variables to all subsequent jobs (while they run
; locally). If output given by a job is in form of two lines
; "LOCATION:xxxx\nMSG:yyyy", PhpDock shows message yyy and redirects to xxxx.
; URLs can be local, like http://localhost:${HTTPServer:Listen}/job1.php or
; not local.
[Jobs]
1=http://localhost:${HTTPServer:Listen}/sample/conveter-service.php
;2=http://localhost:${HTTPServer:Listen}/job1.php
; JobCtl section provides more control on Jobs running per previous sectoin
; AskForJobRedirects when set asks user upon redirection is requested by Job
; ShowJobError when set shows background job errors in status bar icon.
[JobCtl]
AskForJobRedirects=1
ShowJobError=1
Packaging User Application with PhpDock
PhpDock is a deployment tool, so it is expected to be packaged for the distribution to multiple end users of the User Application. The developers are free to use the installation program of their choice to package PhpDock and the Application scripts together such that when installed the same directory structure is preserved under PhpDock installation directory.
Typically the end user installer would unpacks PhpDock, PHP and the Application itself into
a target directory and set up a link in the user's start menu.
|