### Download Symfony Installer Source: https://github.com/cztomczak/phpdesktop/wiki/PHP-frameworks-support Use this command to download the Symfony installer script. ```bash php.exe -r "readfile('http://symfony.com/installer');" > symfony.phar ``` -------------------------------- ### Example output of $_ENV Source: https://github.com/cztomczak/phpdesktop/wiki/Command-line-arguments The resulting structure of the $_ENV array after passing custom environment variables. ```text Array ( [SERVER_NAME] => 127.0.0.1 .. [SOME] => 1 [ABC] => 2 ) ``` -------------------------------- ### Enable Flash Player Source: https://github.com/cztomczak/phpdesktop/wiki/Chrome-settings Enable Flash playback by setting the 'enable-system-flash' command line switch. Requires PPAPI system-wide plugin installation. ```json {"enable-system-flash": ""} ``` -------------------------------- ### HTML5 localStorage and IndexedDB Example Source: https://context7.com/cztomczak/phpdesktop/llms.txt Demonstrates storing and retrieving data using `localStorage` and setting up an `IndexedDB` object store. This code runs in the browser and persists when the fixed port configuration is active. ```html Persistent Storage Example ``` -------------------------------- ### Full $_ENV Dump Example Source: https://github.com/cztomczak/phpdesktop/wiki/Environment-variables A comprehensive list of environment variables available to a PHP script, generated using PHP Desktop with Chrome. This includes server, request, and system variables. ```html [SERVER_NAME] => 127.0.0.1 [SERVER_ROOT] => C:\phpdesktop\phpdesktop-chrome\www [DOCUMENT_ROOT] => C:\phpdesktop\phpdesktop-chrome\www [SERVER_SOFTWARE] => Mongoose/3.9c [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REDIRECT_STATUS] => 200 [SERVER_PORT] => 56918 [REQUEST_METHOD] => GET [REMOTE_ADDR] => 127.0.0.1 [REMOTE_PORT] => 56920 [REQUEST_URI] => /env-variables.php [SCRIPT_NAME] => /env-variables.php [SCRIPT_FILENAME] => C:\phpdesktop\phpdesktop-chrome\www\env-variables.php [PATH_TRANSLATED] => C:\phpdesktop\phpdesktop-chrome\www\env-variables.php [HTTPS] => off [PATH] => C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Java\jre7\bin\;c:\bin\;c:\Program Files (x86)\Git\bin\;c:\Python27\;;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\TortoiseGit\bin;C:\Go\bin;C:\MinGW\bin; [APPDATA] => C:\Users\ctomczak\AppData\Roaming [LOCALAPPDATA] => C:\Users\ctomczak\AppData\Local [ComSpec] => C:\Windows\system32\cmd.exe [COMSPEC] => C:\Windows\system32\cmd.exe [OS] => Windows_NT [ProgramFiles] => C:\Program Files (x86) [PROGRAMFILES] => C:\Program Files (x86) [ProgramFiles(x86)] => C:\Program Files (x86) [ProgramW6432] => C:\Program Files [CommonProgramFiles] => C:\Program Files (x86)\Common Files [CommonProgramFiles(x86)] => C:\Program Files (x86)\Common Files [CommonProgramW6432] => C:\Program Files\Common Files [SystemDrive] => C: [SYSTEMDRIVE] => C: [SystemRoot] => C:\Windows [SYSTEMROOT] => C:\Windows [windir] => C:\Windows [WINDIR] => C:\Windows [ALLUSERSPROFILE] => C:\ProgramData [ProgramData] => C:\ProgramData [PROGRAMDATA] => C:\ProgramData f [PUBLIC] => C:\Users\Public [USERDOMAIN] => ctomczak-PC [USERPROFILE] => C:\Users\ctomczak [HOMEPATH] => \Users\ctomczak [HOMEDRIVE] => C: [COMPUTERNAME] => CTOMCZAK-PC [LOGONSERVER] => \\CTOMCZAK-PC [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC [PSModulePath] => C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ [USERNAME] => ctomczak [HTTP_HOST] => 127.0.0.1:56918 [HTTP_CONNECTION] => keep-alive [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36 [HTTP_REFERER] => http://127.0.0.1:56918/ [HTTP_ACCEPT_ENCODING] => gzip,deflate [HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.8 [TMP] => C:\Users\ctomczak\AppData\Local\Temp\ [TEMP] => C:\Users\ctomczak\AppData\Local\Temp\ [TMPDIR] => C:\Users\ctomczak\AppData\Local\Temp\ [PHPDESKTOP_VERSION] => 31.8 ``` -------------------------------- ### Execute WMIC Command in PHP Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base Example of using shell_exec to run a WMIC command, including the echo pipe to prevent hanging on Windows XP. ```php $output = shell_exec("echo | {$_ENV['SYSTEMROOT']}\System32\wbem\wmic.exe path win32_computersystemproduct get uuid"); if ($output) echo "Command succeeded. Output=".$output; else echo "Command failed."; ``` -------------------------------- ### Locate PHP CGI Binary on Linux Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base Use the find command to search the filesystem for installed PHP CGI binaries. ```bash sudo find / -name php-cgi ``` -------------------------------- ### Enable System Flash in PHP Desktop Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base For PHP Desktop v47 and later, use this command-line switch in settings.json to enable system Flash. Ensure Flash is installed in your OS. ```json command_line_switches: { "enable-system-flash": "" } ``` -------------------------------- ### Mongoose Web Server Environment Variables Example Source: https://github.com/cztomczak/phpdesktop/wiki/Environment-variables Displays environment variables related to the Mongoose web server. These are typically available in PHP scripts running within the PHP Desktop environment. ```html [SERVER_SOFTWARE] => Mongoose/3.9c [SERVER_PORT] => 56920 ``` -------------------------------- ### View encoded file output Source: https://github.com/cztomczak/phpdesktop/wiki/Source-code-protection Example of how the source code appears after being processed by the BLENC encoder. ```text BLENC 1.1.4b c269d23aa66d05474d7b408484c74c1d\n Ô)÷M¤ÙÃAÓ‚`°¯ aq`ÊÅÞc|RÇ–;ù‚׋+ÆZe‚¢yv6B.hí ``` -------------------------------- ### Execute External Programs Asynchronously in PHP Source: https://context7.com/cztomczak/phpdesktop/llms.txt Use `exec` with NirCmd or the Windows `start` command for asynchronous execution. `proc_open` can also be used to run processes in the background without blocking the PHP script. ```php array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $process = proc_open("C:/path/to/long-running-task.exe", $descriptors, $pipes); if (is_resource($process)) { // Don't wait for process, continue script execution fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); // Process continues in background } echo "Task started in background"; ?> ``` -------------------------------- ### Get Last Insert ID Source: https://github.com/cztomczak/phpdesktop/wiki/Using-SQLite Retrieve the ID generated by the last INSERT query. ```php $id = PDO_LastInsertId(); ``` -------------------------------- ### Verify PHP CGI Binary Information Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base Execute the binary to generate an HTML file containing configuration details, then open it in a browser to inspect enabled extensions. ```bash /etc/alternatives/php-cgi -i > phpinfo.html google-chrome phpinfo.html ``` -------------------------------- ### Build PHP from Sources Source: https://github.com/cztomczak/phpdesktop/wiki/Build-on-Linux Run the provided script to build PHP from its downloaded sources. The script handles copying the php-cgi executable to the build/bin/ directory. ```bash phpdesktop/build-php.sh ``` -------------------------------- ### Generate Unique Computer Identifier Source: https://context7.com/cztomczak/phpdesktop/llms.txt Create a machine-specific hash by combining the Windows UUID, processor ID, and machine GUID. ```php RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography\\MachineGuid"); $identifiers['machine_guid'] = $machineGuid; } catch (Exception $e) {} // Generate unique hash from combined identifiers $combined = implode('|', $identifiers); return md5($combined); } $uniqueId = getUniqueComputerId(); echo "Machine ID: $uniqueId"; // Output: Machine ID: a1b2c3d4e5f6789012345678abcdef12 ?> ``` -------------------------------- ### Build PHP Desktop Project Source: https://github.com/cztomczak/phpdesktop/wiki/Build-on-Linux Execute the main build script for the phpdesktop-linux project. This command should be run from the phpdesktop/ directory. ```bash ./build.sh ``` -------------------------------- ### Configure PHP Desktop Web Server for Laravel Source: https://github.com/cztomczak/phpdesktop/wiki/PHP-frameworks-support Point the web server directory to the public folder and set the 404 handler in settings.json. ```json "web_server": { ... "www_directory": "www/public", ... "404_handler": "/index.php" ``` -------------------------------- ### Configure Laravel for PHP Desktop Source: https://context7.com/cztomczak/phpdesktop/llms.txt Set the web server directory and 404 handler in settings.json, and configure the database connection to use SQLite. ```json { "web_server": { "www_directory": "www/public", "404_handler": "/index.php" } } ``` ```php 'sqlite', 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'database' => database_path('production.sqlite'), 'prefix' => '', ], ], ]; // Directory structure: // phpdesktop-chrome/ // ├── www/ // │ ├── app/ // │ ├── bootstrap/ // │ ├── public/ <- www_directory points here // │ │ └── index.php // │ └── vendor/ // ├── php/ // ├── settings.json // └── phpdesktop-chrome.exe ?> ``` -------------------------------- ### Create Zend Framework Project with Composer Source: https://github.com/cztomczak/phpdesktop/wiki/PHP-frameworks-support Use Composer to create a new Zend Framework project from the skeleton application. Ensure you are in the 'phpdesktop-chrome/www/' directory. ```bash php.exe composer.phar create-project --repository-url="http://packages.zendframework.com" zendframework/skeleton-application ./ ``` -------------------------------- ### Build CEF Client with Ninja Source: https://github.com/cztomczak/phpdesktop/wiki/Build-on-Linux Compile the CEF client executable using Ninja. This command should be run from the build directory created in the previous step. ```bash ninja cefclient ``` -------------------------------- ### Main Configuration: settings.json Source: https://context7.com/cztomczak/phpdesktop/llms.txt The primary configuration file for PHP Desktop applications, controlling window settings, web server behavior, and browser options. Ensure correct JSON formatting for all settings. ```json { "application": { "single_instance_guid": "4C00DEC0-9298-4dc4-98BD-0FAE9F3BA730", "dpi_aware": true }, "debugging": { "show_console": false, "subprocess_show_console": false, "log_level": "INFO", "log_file": "debug.log" }, "main_window": { "title": "My Application", "icon": "icon.ico", "default_size": [1024, 768], "minimum_size": [800, 600], "maximum_size": [0, 0], "disable_maximize_button": false, "center_on_screen": true, "start_maximized": false, "start_fullscreen": false, "always_on_top": false, "minimize_to_tray": false, "minimize_to_tray_message": "Minimized to tray" }, "popup_window": { "icon": "", "fixed_title": "", "center_relative_to_parent": true, "default_size": [1024, 768] }, "web_server": { "listen_on": ["127.0.0.1", 54007], "www_directory": "www", "index_files": ["index.html", "index.php"], "cgi_interpreter": "php/php-cgi.exe", "cgi_extensions": ["php"], "cgi_temp_dir": "", "404_handler": "/pretty-urls.php", "hide_files": [".*", "secret.txt"] }, "chrome": { "cache_path": "webcache", "log_file": "debug.log", "log_severity": "default", "reload_page_F5": true, "devtools_F12": true, "external_drag": true, "external_navigation": true, "remote_debugging_port": 0, "runtime_style": "alloy", "command_line_switches": { "lang": "en", "enable-media-stream": "", "enable-system-flash": "" }, "context_menu": { "enable_menu": true, "navigation": true, "print": true, "view_source": true, "open_in_external_browser": true, "devtools": true } } } ``` -------------------------------- ### Execute External Program Asynchronously with NirCmd Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base Use the PHP exec command with NirCmd to run external applications in the background without waiting for them to complete. Ensure NirCmd is installed and its path is correctly specified. ```php exec("\"C:/path/to/nircmd.exe\" exec hide \"C:/path/to/other/app.exe\""); ``` -------------------------------- ### Import .reg File using System Command Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base Execute a system command to import a .reg file using the 'reg import' tool. Type 'reg /?' for more options. ```php system("reg import file.reg"); ``` -------------------------------- ### Connect to Database Source: https://github.com/cztomczak/phpdesktop/wiki/Using-SQLite Establish a connection to a SQLite database file or a MySQL server. ```php $db_file = "./my_database.sqlite3"; PDO_Connect("sqlite:$db_file"); ``` ```php PDO_Connect('mysql:host=localhost;dbname=testdb;charset=UTF-8', 'username','password'); ``` -------------------------------- ### List Available Win32 Hardware Classes Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base Common hardware classes and properties available for querying via WMIC. ```text win32_computersystemproduct: name, uuid, vendor, version win32_processor: uniqueid, processorid, name, manufacturer, maxclockspeed win32_bios: manufacturer, smbiosbiosversion, identificationcode, serialnumber, releasedate, version win32_diskdrive: model, manufacturer, signature, totalheads win32_baseboard: model, manufacturer, name, serialnumber win32_videocontroller: driverversion, name ``` -------------------------------- ### Configure CEF Build Environment Source: https://github.com/cztomczak/phpdesktop/wiki/Build-on-Windows Sets up the environment variables for Visual Studio 2015 to allow command-line builds. ```batch "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat" ``` -------------------------------- ### Context Menu Settings Source: https://github.com/cztomczak/phpdesktop/wiki/Chrome-settings Configure the options available in the mouse context menu. ```APIDOC ## context_menu ### Description Configurable options for the mouse context menu. ### Default Value {} ### Options - **enable_menu** (boolean): Whether to enable the context menu. - **navigation** (boolean): Whether to show "Back", "Forward", and "Reload" options. - **print** (boolean): Whether to show the "Print..." option. - **view_source** (boolean): Whether to show the "View source" option. - **open_in_external_browser** (boolean): Whether to show "Open page/frame in external browser" options. - **devtools** (boolean): Whether to show the "Show Developer Tools" option. Requires `remote_debugging_port` to be set. ``` -------------------------------- ### Configure PHP Desktop Web Server for CodeIgniter Source: https://github.com/cztomczak/phpdesktop/wiki/PHP-frameworks-support Set the 404 handler in settings.json to ensure CodeIgniter handles routing correctly. ```json "web_server": { ... "404_handler": "/index.php" ``` -------------------------------- ### Configure PHP Desktop Web Server for CakePHP Source: https://github.com/cztomczak/phpdesktop/wiki/PHP-frameworks-support Update settings.json to point the web server to the webroot directory and set the 404 handler. ```json "web_server": { ... "www_directory": "www/app/webroot", ... "404_handler": "/index.php" ``` -------------------------------- ### SQLite Database Integration with PDO Source: https://context7.com/cztomczak/phpdesktop/llms.txt Demonstrates connecting to an SQLite database, creating tables, inserting data with parameter binding, and fetching data using PDO helper functions. Ensure the PDO helper functions are included. ```php "John Doe", "email" => "john@example.com") ); // Get last inserted ID $userId = PDO_LastInsertId(); echo "Inserted user with ID: $userId\n"; // Fetch single value $count = PDO_FetchOne("SELECT COUNT(*) FROM users"); echo "Total users: $count\n"; // Fetch single row $user = PDO_FetchRow( "SELECT * FROM users WHERE id = :id", array("id" => $userId) ); print_r($user); // Output: Array ( [id] => 1 [name] => John Doe [email] => john@example.com [created_at] => 2024-01-15 10:30:00 ) // Fetch all rows $users = PDO_FetchAll( "SELECT * FROM users WHERE created_at > :date", array("date" => "2024-01-01") ); foreach ($users as $user) { echo "{$user['name']} - {$user['email']}\n"; } // Fetch as associative array (key => value) $emailMap = PDO_FetchAssoc("SELECT name, email FROM users"); // Output: Array ( [John Doe] => john@example.com ) // Update data PDO_Execute( "UPDATE users SET name = :name WHERE id = :id", array("name" => "Jane Doe", "id" => $userId) ); ?> ``` -------------------------------- ### Configure listen_on for all network interfaces Source: https://github.com/cztomczak/phpdesktop/wiki/Settings Set the listen_on parameter to allow the server to listen on all network cards. ```json "listen_on": ["*", 54007] ``` -------------------------------- ### Run PHP Scripts from Command Line Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base Navigate to the php directory and execute scripts using php.exe or php-cgi.exe to diagnose loading issues with PHP extensions or other problems. Test with both executables as they have different implementations. ```bash cd phpdesktop/php/ php.exe ../www/script.php ``` ```bash php-cgi.exe ../www/script.php ``` -------------------------------- ### Generate Symfony Project Source: https://github.com/cztomczak/phpdesktop/wiki/PHP-frameworks-support Command to create a new Symfony project directory. ```bash php.exe symfony.phar new myproject ``` -------------------------------- ### Configure PHP Extension Directory Source: https://github.com/cztomczak/phpdesktop/wiki/Build-on-Windows Sets the extension directory in php.ini to the current directory, required for Windows XP support. ```ini extension_dir=./ ``` -------------------------------- ### Configuration: settings.json Source: https://context7.com/cztomczak/phpdesktop/llms.txt The main configuration file for PHP Desktop applications. It controls window settings, web server behavior, and browser options. ```APIDOC ## Configuration: settings.json The main configuration file that controls all aspects of the PHP Desktop application including window settings, web server configuration, and browser behavior. ### Request Body - **application** (object) - Application-level settings. - **single_instance_guid** (string) - GUID to ensure single instance. - **dpi_aware** (boolean) - Enables DPI awareness. - **debugging** (object) - Debugging and logging settings. - **show_console** (boolean) - Show console window for the main process. - **subprocess_show_console** (boolean) - Show console window for subprocesses. - **log_level** (string) - Logging verbosity (e.g., INFO, DEBUG). - **log_file** (string) - Path to the log file. - **main_window** (object) - Settings for the main application window. - **title** (string) - Window title. - **icon** (string) - Path to the window icon file. - **default_size** (array) - Default window dimensions [width, height]. - **minimum_size** (array) - Minimum window dimensions [width, height]. - **maximum_size** (array) - Maximum window dimensions [width, height]. - **disable_maximize_button** (boolean) - Disables the maximize button. - **center_on_screen** (boolean) - Centers the window on screen. - **start_maximized** (boolean) - Starts the application maximized. - **start_fullscreen** (boolean) - Starts the application in fullscreen mode. - **always_on_top** (boolean) - Keeps the window always on top. - **minimize_to_tray** (boolean) - Minimizes the window to the system tray. - **minimize_to_tray_message** (string) - Message shown when minimizing to tray. - **popup_window** (object) - Settings for popup windows. - **icon** (string) - Path to the popup window icon file. - **fixed_title** (string) - Fixed title for popup windows. - **center_relative_to_parent** (boolean) - Centers popup relative to parent. - **default_size** (array) - Default popup window dimensions [width, height]. - **web_server** (object) - Web server configuration. - **listen_on** (array) - IP address and port to listen on. - **www_directory** (string) - Directory containing web content. - **index_files** (array) - Files to serve as index pages. - **cgi_interpreter** (string) - Path to the PHP-CGI interpreter. - **cgi_extensions** (array) - File extensions handled by CGI. - **cgi_temp_dir** (string) - Temporary directory for CGI. - **404_handler** (string) - Handler for 404 errors. - **hide_files** (array) - Files to hide from the web server. - **chrome** (object) - Chrome/Chromium browser settings. - **cache_path** (string) - Path for browser cache. - **log_file** (string) - Path for browser log file. - **log_severity** (string) - Browser log severity level. - **reload_page_F5** (boolean) - Enable page reload with F5. - **devtools_F12** (boolean) - Enable developer tools with F12. - **external_drag** (boolean) - Enable external drag and drop. - **external_navigation** (boolean) - Enable external navigation. - **remote_debugging_port** (integer) - Port for remote debugging. - **runtime_style** (string) - Browser runtime style (e.g., alloy). - **command_line_switches** (object) - Command line switches for the browser. - **lang** (string) - Language setting. - **enable-media-stream** (string) - Enable media stream. - **enable-system-flash** (string) - Enable system Flash. - **context_menu** (object) - Browser context menu settings. - **enable_menu** (boolean) - Enable context menu. - **navigation** (boolean) - Enable navigation items in context menu. - **print** (boolean) - Enable print option. - **view_source** (boolean) - Enable view source option. - **open_in_external_browser** (boolean) - Enable opening in external browser. - **devtools** (boolean) - Enable developer tools in context menu. ### Request Example ```json { "application": { "single_instance_guid": "4C00DEC0-9298-4dc4-98BD-0FAE9F3BA730", "dpi_aware": true }, "debugging": { "show_console": false, "subprocess_show_console": false, "log_level": "INFO", "log_file": "debug.log" }, "main_window": { "title": "My Application", "icon": "icon.ico", "default_size": [1024, 768], "minimum_size": [800, 600], "maximum_size": [0, 0], "disable_maximize_button": false, "center_on_screen": true, "start_maximized": false, "start_fullscreen": false, "always_on_top": false, "minimize_to_tray": false, "minimize_to_tray_message": "Minimized to tray" }, "popup_window": { "icon": "", "fixed_title": "", "center_relative_to_parent": true, "default_size": [1024, 768] }, "web_server": { "listen_on": ["127.0.0.1", 54007], "www_directory": "www", "index_files": ["index.html", "index.php"], "cgi_interpreter": "php/php-cgi.exe", "cgi_extensions": ["php"], "cgi_temp_dir": "", "404_handler": "/pretty-urls.php", "hide_files": [".*", "secret.txt"] }, "chrome": { "cache_path": "webcache", "log_file": "debug.log", "log_severity": "default", "reload_page_F5": true, "devtools_F12": true, "external_drag": true, "external_navigation": true, "remote_debugging_port": 0, "runtime_style": "alloy", "command_line_switches": { "lang": "en", "enable-media-stream": "", "enable-system-flash": "" }, "context_menu": { "enable_menu": true, "navigation": true, "print": true, "view_source": true, "open_in_external_browser": true, "devtools": true } } } ``` ``` -------------------------------- ### Configure Zend Framework Web Server Settings Source: https://github.com/cztomczak/phpdesktop/wiki/PHP-frameworks-support Set the 'www_directory' to 'www/public' and '404_handler' to '/index.php' in settings.json for Zend Framework projects. ```json "web_server": { ... "www_directory": "www/public", ... "404_handler": "/index.php" ``` -------------------------------- ### Create the target script for encoding Source: https://github.com/cztomczak/phpdesktop/wiki/Source-code-protection This is the source file that will be encrypted by the encoding script. ```php ``` -------------------------------- ### Set Custom Proxy Server Source: https://github.com/cztomczak/phpdesktop/wiki/Chrome-settings Configure a custom proxy server using the 'proxy-server' command line switch. Supports SOCKS and other proxy types. ```json {"proxy-server": "socks5://127.0.0.1:8888"} ``` -------------------------------- ### Configure BLENC in php.ini Source: https://github.com/cztomczak/phpdesktop/wiki/Source-code-protection Add these lines to your php.ini file to enable the extension and define the key file path. ```ini extension=php_blenc.dll\nblenc.key_file="./../www/.blenc_keys" ``` -------------------------------- ### Enable Developer Tools via F12 Source: https://github.com/cztomczak/phpdesktop/wiki/Chrome-settings Toggle developer tools accessibility by pressing the F12 key. Requires 'remote_debugging_port' to be set. ```json devtools_F12: true ``` -------------------------------- ### Enable Startup Error Display Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base Set `display_startup_errors=On` in php.ini to show PHP startup errors, such as failed extension loading, in a user-friendly graphical message. This avoids the need to run scripts from the command line for debugging. ```ini display_startup_errors=On ``` -------------------------------- ### Configure CEF Build with CMake Source: https://github.com/cztomczak/phpdesktop/wiki/Build-on-Linux Use CMake to configure the build for the CEF client. Ensure Ninja is in your PATH or build directory. Set CMAKE_BUILD_TYPE to 'Release' for production builds or 'Debug' for debugging. ```bash cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DUSE_SANDBOX=OFF ../ ``` -------------------------------- ### Read Windows Registry with PHP Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base Use the php_com_dotnet.dll extension to read from the Windows Registry. Ensure the extension is enabled in php.ini. Requires Windows Scripting Host. ```php $shell = new COM("WScript.Shell") or die("Requires Windows Scripting Host"); $some = $shell->RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\..."); ``` -------------------------------- ### Passing Custom Environment Variables via Command Line Source: https://context7.com/cztomczak/phpdesktop/llms.txt Launch the PHP Desktop executable with custom CGI environment variables using the `--cgi-environment` flag. Multiple variables can be passed as a comma-separated string. ```bash # Pass custom CGI environment variables to PHP phpdesktop-chrome.exe --cgi-environment="APP_MODE=production,DEBUG=0,USER_ID=123" ``` ```bash # Enable media streaming from command line phpdesktop-chrome.exe --enable-media-stream ``` ```bash # Combine multiple options phpdesktop-chrome.exe --cgi-environment="CUSTOM_VAR=value" --lang=fr --enable-media-stream ``` -------------------------------- ### Enable Speech Input Source: https://github.com/cztomczak/phpdesktop/wiki/Chrome-settings Enable speech input functionality (x-webkit-speech) by setting the 'enable-speech-input' command line switch. ```json {"enable-speech-input": ""} ``` -------------------------------- ### Configure Yii Web Server Settings Source: https://github.com/cztomczak/phpdesktop/wiki/PHP-frameworks-support Set the 'www_directory' and '404_handler' in settings.json for Yii projects. ```json "web_server": { "www_directory": "www/demos/blog", ... "404_handler": "/index.php" ``` -------------------------------- ### Enable Media Streaming Source: https://github.com/cztomczak/phpdesktop/wiki/Chrome-settings Enable WebRTC audio and video streaming by setting the 'enable-media-stream' command line switch. ```json {"enable-media-stream": ""} ``` -------------------------------- ### MSIE Configuration Settings Source: https://github.com/cztomczak/phpdesktop/wiki/MSIE-settings Configuration options for the MSIE engine in settings.json. ```APIDOC ## MSIE Settings Configuration ### Description These settings control the behavior of the MSIE browser engine within the phpdesktop application. ### Configuration Fields - **error_page** (string) - Default: "error_page.html". Path to a static HTML file displayed on navigation errors. - **smooth_scroll** (boolean) - Default: false. Enables smooth scrolling. - **enable_f5_refresh** (boolean) - Default: false. Enables F5 key to refresh the page. - **show_context_menu** (boolean) - Default: false. Toggles mouse context menu. - **disable_script_debugger** (boolean) - Default: false. Disables the script debugger dialog on JS errors. - **hide_dialog_boxes** (boolean) - Default: false. Hides dialog boxes and messages (excluding critical errors). - **silent_operations** (boolean) - Default: false. Suppresses all UI notifications. - **use_themes** (boolean) - Default: true. Enables themes for displayed pages. - **autocomplete_forms** (boolean) - Default: false. Enables form autocomplete. - **windowed_select_control** (boolean) - Default: true. Uses windowed select controls if true, windowless if false. - **disable_scrollbars** (boolean) - Default: false. Disables scrollbars. - **flat_scrollbars** (boolean) - Default: false. Uses flat scrollbars. - **utf8_url_encoding** (boolean) - Default: true. Enables UTF-8 encoding for URLs. - **dpi_aware** (boolean) - Default: false. Calculates document pixels as 96 DPI. - **registry_settings_path** (string) - Default: "". Path to registry settings (not yet implemented). ``` -------------------------------- ### window.phpdesktop API Source: https://github.com/cztomczak/phpdesktop/wiki/Javascript-API Methods exposed through the window.phpdesktop object for managing application state and versioning. ```APIDOC ## window.phpdesktop.GetVersion() ### Description Returns the version string of the PHP Desktop executable. ## window.phpdesktop.ToggleFullscreen() ### Description Toggles the application window between fullscreen and windowed mode. ## window.phpdesktop.IsFullscreen() ### Description Returns a boolean indicating whether the application is currently in fullscreen mode. ``` -------------------------------- ### Configure Persistent HTML5 Storage Source: https://context7.com/cztomczak/phpdesktop/llms.txt Set a fixed port in `web_server.listen_on` to enable persistent HTML5 storage like localStorage and IndexedDB across application restarts. Ensure the `chrome.cache_path` is configured. ```json { "web_server": { "listen_on": ["127.0.0.1", 54007] }, "chrome": { "cache_path": "webcache" } } ``` -------------------------------- ### Configure CodeIgniter for PHP Desktop Source: https://context7.com/cztomczak/phpdesktop/llms.txt Adjust the web server configuration and database settings to support pretty URLs and SQLite in CodeIgniter. ```json { "web_server": { "www_directory": "www", "404_handler": "/index.php" } } ``` ```php ``` -------------------------------- ### Global Window Functions Source: https://github.com/cztomczak/phpdesktop/wiki/Javascript-API Standard window functions supported by the PHP Desktop environment. ```APIDOC ## window.close() ### Description Closes the current application window. ``` -------------------------------- ### Generate CEF Build Files with CMake Source: https://github.com/cztomczak/phpdesktop/wiki/Build-on-Windows Configures the build system using CMake with Ninja generator and sandbox disabled. ```bash cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DUSE_SANDBOX=OFF .. ``` -------------------------------- ### Include PDO Helper Source: https://github.com/cztomczak/phpdesktop/wiki/Using-SQLite Include the helper script before using any PDO functions. ```php include "./_pdo.php"; ``` -------------------------------- ### Router Script for Pretty URLs Source: https://context7.com/cztomczak/phpdesktop/llms.txt A sample `router.php` script that handles all 404 requests by parsing the URL and routing to appropriate controller files. This script demonstrates basic routing logic. ```php controller=users, action=profile, params=[123] // /products/view/456 -> controller=products, action=view, params=[456] // /api/data -> controller=api, action=data ?> ``` -------------------------------- ### Configure Context Menu Options Source: https://github.com/cztomczak/phpdesktop/wiki/Chrome-settings Customize the mouse context menu by enabling or disabling specific options like navigation, print, view source, and developer tools. ```json context_menu: { "enable_menu": true, "navigation": true, "print": true, "view_source": true, "open_in_external_browser": true, "devtools": true } ``` -------------------------------- ### Execute Queries Source: https://github.com/cztomczak/phpdesktop/wiki/Using-SQLite Perform INSERT or UPDATE operations on the database. ```php PDO_Execute("INSERT INTO fruits (name, calories) VALUES (:name, :calories)", array("name"=>"apple", "calories"=>150)); ``` ```php PDO_Execute("UPDATE fruits SET calories = 150 WHERE name = 'apple'"); ``` -------------------------------- ### Chrome Command Line Switches Source: https://context7.com/cztomczak/phpdesktop/llms.txt Configure Chromium browser behavior using command line switches within the settings.json file. ```APIDOC ## Chrome Command Line Switches Configure Chromium behavior through command line switches in settings.json for features like language, media streaming, proxy settings, and security options. ### Request Body - **chrome.command_line_switches** (object) - Object containing command line switches. - **lang** (string) - Sets the browser language (e.g., "fr"). - **enable-media-stream** (string) - Enables media streaming. - **enable-system-flash** (string) - Enables system Flash player. - **enable-speech-input** (string) - Enables speech input. - **disable-web-security** (string) - Disables web security features. - **proxy-server** (string) - Sets a proxy server (e.g., "socks5://127.0.0.1:8888"). - **no-proxy-server** (string) - Disables proxy server. - **enable-logging** (string) - Enables logging to a specified output (e.g., "stderr"). - **disable-gpu** (string) - Disables GPU hardware acceleration. - **disable-gpu-compositing** (string) - Disables GPU compositing. - **user-agent** (string) - Sets a custom user agent string. ### Request Example ```json { "chrome": { "command_line_switches": { "lang": "fr", "enable-media-stream": "", "enable-system-flash": "", "enable-speech-input": "", "disable-web-security": "", "proxy-server": "socks5://127.0.0.1:8888", "no-proxy-server": "", "enable-logging": "stderr", "disable-gpu": "", "disable-gpu-compositing": "", "user-agent": "MyCustomApp/1.0" } } } ``` ``` -------------------------------- ### Command Line Switches Source: https://github.com/cztomczak/phpdesktop/wiki/Chrome-settings Customize browser behavior using Chrome command-line switches. ```APIDOC ## command_line_switches ### Description Allows customization through Chrome command-line switches. Switches are provided as a dictionary in `settings.json`, with the switch name as the key. Prefixes like "-" or "--" should be omitted from the switch name. Switch values can be empty strings if not required. These switches apply only to the main browser process. Refer to [Chromium Command Line Switches](http://peter.sh/experiments/chromium-command-line-switches/) for a comprehensive list. ### Default Value {} ### Example ```json { "lang": "fr", "enable-media-stream": "", "enable-system-flash": "" } ``` ### Common Switches - **lang** (string): Sets the language file to open (e.g., "fr"). - **enable-media-stream** (string): Enables media streaming (WebRTC audio/video). - **enable-system-flash** (string): Enables Flash. Requires PPAPI system-wide plugin installation. - **enable-speech-input** (string): Enables speech input (x-webkit-speech). - **disable-web-security** (string): Disables the same-origin policy. - **proxy-server** (string): Sets a custom proxy (e.g., "socks5://127.0.0.1:8888"). - **no-proxy-server** (string): Disables the use of IE proxy settings. - **enable-logging** (string): Enables logging only to the terminal, disabling file logging. ``` -------------------------------- ### Apache mod_rewrite equivalent for 404_handler Source: https://github.com/cztomczak/phpdesktop/wiki/Settings Use these rules to enable pretty URL support via the 404_handler configuration. ```apache RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ pretty-urls.php/$1 [L] ``` -------------------------------- ### Symfony Index File Configuration Source: https://github.com/cztomczak/phpdesktop/wiki/PHP-frameworks-support Create an index.php file to include the Symfony development application file. This is used when 'myproject/web/app.php' causes a 404 error. ```php ``` -------------------------------- ### Create NTFS Symbolic Link for Unicode Paths Source: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base Use `mklink` to create a symbolic link for directories with unicode characters if PHP encounters path issues. This is a workaround for PHP's lack of native unicode path support. Ensure you are on an NTFS partition. ```cmd mklink /D C:\sites C:\gonzález\sites ``` -------------------------------- ### Access Windows Registry via COM Source: https://context7.com/cztomczak/phpdesktop/llms.txt Read and write registry keys using the WScript.Shell COM object. Requires the php_com_dotnet.dll extension to be enabled in php.ini. ```php RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName"); echo "Windows Version: $productName\n"; // Read application-specific settings try { $appSetting = $shell->RegRead("HKEY_CURRENT_USER\\SOFTWARE\\MyApp\\Setting1"); echo "App Setting: $appSetting\n"; } catch (Exception $e) { echo "Registry key not found\n"; } // Write to registry $shell->RegWrite("HKEY_CURRENT_USER\\SOFTWARE\\MyApp\\Setting1", "MyValue", "REG_SZ"); $shell->RegWrite("HKEY_CURRENT_USER\\SOFTWARE\\MyApp\\Counter", 42, "REG_DWORD"); // Import a .reg file system("reg import settings.reg"); // Export registry to file system("reg export HKEY_CURRENT_USER\\SOFTWARE\\MyApp backup.reg /y"); ?> ```