-
-
Notifications
You must be signed in to change notification settings - Fork 576
Settings
This page describes options that can be found in the "settings.json" file.
Table of Contents generated with DocToc
Default value: ""
Set this to non-empty string to disallow multiple instances of your application. This string should be unique. It is recommended to use a GUID generator for that. An example GUID would be: "4C00DEC0-9298-4dc4-98BD-0FAE9F3BA730".
Default value: true
Since PHPDesktop Chrome 39 behavior of DPI and zomming has changed. DPI awareness is always enabled in phpdesktop (DeclareDPIAware.manifest is embedded in exe). Setting this option to false will only affect window size during creation.
Whether application should be DPI aware. If you change text size settings on Windows (in Win7 go to Control Panel -> Appearance and Personalization -> Display), then app will detect this and enlarge texts in the Chrome browser. Chrome zooming techology will be used. System's default text enlarging mechanism that would make text look fuzzy won't be used.
When dpi aware is set to true, besides enlarging text size, the window size (specified by the "default_size" setting under the "main_window" section) will also be enlarged respectively. So if the Win7 text size settings are set to Large (150%) and you set the default_size to [1024, 768], then the window will be resized to [1536, 1152].
Default value: false
Whether to show command-line console with debug output. This is almost the same output that is written to the log file with the exception that messages from the subprocesses (Renderer, GPU) are not visible in the main console window.
Default value: false
Show more consoles for all Chrome subprocesses.
Default value: "INFO"
Application level logging (do not mistake with php logging), possible values are: ERROR, WARNING, INFO, DEBUG, DEBUG1, DEBUG2, DEBUG3, DEBUG4. Level of ERROR will only log severe errors, DEBUG4 is most verbose.
Default value: ""
Log file for application logging. Do not mistake with php logging. To set php log file set the "error_log" option in php.ini: http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log
Debug output is written to this file, set it to empty string to disable logging to file.
Restriction: Only one instance of an application can log to that file at the same time, when second instance of an application is started, it won't write messages to the log file.
Default value: "PHP Desktop MSIE"
Main window title. If set to empty executable's name will be used instead.
Default value: ""
Set icon for main window. The allowed extension for the icon is "ico". Only relative path is allowed.
If you would like to change the icon that is embedded in the executable file then do the following steps:
- Download Resource Hacker and run it.
- From the "File" menu select open, navigate and choose "phpdesktop-msie.exe" (or "phpdesktop-chrome.exe").
- On the left side there should be a tree control, expand "/Icon Group/128/1033", right click on the "1033", select "Replace Resource..." and replace that resource with your icon.
- That's it, save it and see the changes by running the executable file.
When you change icon embedded in the executable file you do not need to set it anymore in the settings file.
Default value: [1024, 768]
Default size of the window, width & height.
Default value: [800, 600]
Minimum size of the window, width & height. User won't be able to resize the window to a size smaller than this. A value of 0 means there is not minimum size limit when resizing.
Default value: [0, 0]
Maximum size of the window, width & height. User won't be able to resize the window to a size bigger than this. A value of 0 means there is no maximum size limit when resizing.
Default value: false
Whether to disable maximize button. You can mix this option along with minimum_size & maximum_size, thus allowing you to define a window with a fixed size that cannot be resized in any way.
Default value: true
Whether to center window on screen. If you set this to false, OS will take care of positioning the window.
Default value: false
Starts the main application window maximized.
Default value: false
Starts the main application window in fullscreen mode.
Default value: false
Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
Default value: false
Whether to minimize to system tray - taskbar icon will be hidden.
Default value: "Minimized to tray"
Message that will be displayed in a Balloon Notification after being minimized.
Default value: false
Not yet implemented. Whether to save window size & position and restore it on next launch of the application. See Issue #89.
Default value: ""
You can set a different icon for popup windows. If set to empty, main window icon will be used.
Default value: ""
The title for the popup window is set according to meta <title>
tag on a webpage, however you can set a fixed title for all
popup windows, in this case meta title will be ignored.
Default value: true
Center popup window relative to the parent window.
Default value: [1024, 768]
The default size used when there is no size specified for the popup window (no width/height parameters passed to window.open).
Default value: ["127.0.0.1", 0]
Ip address and port to listen on. It is recommended for the port to be in range 49152–65535. When set to 0, OS will assign a random free port. It is recommended to set it to 0 to avoid port conflicts.
Note that if you're using HTML5 persistent storage such as local storage, indexed db or web sql, that lives on between application launches, then you need to set a fixed port, eg. ["127.0.0.1", 54007]. See Issue #108 for more details.
To listen on all available IP addresses (local and internet public ip addresses) set the
IP address to "*"
and also set a fixed port (if you need a fixed web server url that
doesn't change with each app relaunch). For example in settings.json set this:
"listen_on": ["*", 54007]
. Mongoose web server will listen on all network cards, but it
is still up to you to detect computer's public IP address. URL address launched in phpdesktop
browser is still local "http://127.0.0.1:xx/"
. Note that you may still need to configure router port
forwarding for it to work for an internet IP address. Note also that when "listen_on" is set to "*"
then the SERVER_NAME environment variable will still be set to 127.0.0.1 - this may cause issues in PHP
scripts that depend on that env variable. To fix it add this code at the top of all your PHP scripts:
<?php $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"]; ?>
. Same for the $_ENV global variable.
This will set SERVER_NAME to an ip address that the web server is being accessed from.
For example when accessing from 127.0.0.1 it will be set to that. When accessing from 192.168.0.2
then it will be 192.xxx in that case. Same for an internet IP address.
Default value: "www"
Document root directory for your PHP scripts.
Default value: ["index.html", "index.php"]
List of files to be treated as directory index. A maximum of 32 files is allowed.
Default value: "php/php-cgi.exe"
CGI interpreter for all CGI scripts regardless script extension.
From Mongoose documentation: "Mongoose decides which interpreter to use by looking at the first line of a CGI script" - this is probably not true after we've set cgi extensions.
Default value: ["php"]
Files with these extension are treated as CGI. A maximum of 32 extensions is allowed.
Default value: ""
The temp directory for the CGI environment. This will set three env variables: TMP, TEMP, TMPDIR. It is recommended to leave this string empty, read below.
If set to empty string PHP Desktop will set a temp directory for you automatically. If the temp directory returned by OS contains unicode characters (PHP doesn't play well with unicode), then it will choose another temp directory for you that will not cause problems with PHP.
Default value: "/pretty-urls.php"
Http 404 not found errors will call the provided php script. You can use this to enable support for pretty urls in application. This is an equivalent of using Apache's mod_rewrite using this set of rules:
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ pretty-urls.php/$1 [L]
</IfModule>
To know what pretty url was accessed check $_SERVER["PATH_INFO"]
or $_SERVER["REQUEST_URI"]
. See pretty-urls.php script for an example.
Default value: []
Patterns for the files to hide. Files that match the pattern will not show up in directory listing and return 404 Not Found
if requested. Pattern must be for a file name only, not including directory name. Maximum number of patterns is 100.
Special characters that can be used in patterns:
-
*
(matches multiple characters) -
?
(matches one character)
Example values: [".*", "secret.txt"]
- hides all files starting with dot and additionally "secret.txt".
MSIE settings are described on a separate wiki page, see the MSIE settings wiki page.
Chrome settings are described on a separate wiki page, see the Chrome settings wiki page.