Programming Notes

Operating Systems

Webman supports both Linux and Windows systems. However, since Workerman does not support multi-process setup and daemon processes on Windows, it is recommended to use Windows only for development and debugging purposes. For production environments, please use Linux.

Startup Methods

Linux Systems

php start.php start

This command runs in debug mode, generally used during development. The monitor process will automatically detect file updates and reload, and printed data will be displayed in the terminal. Webman will also automatically close when the terminal is closed.

php start.php start -d

This command runs in daemon mode, to be used in production environments. Webman continues to run after the terminal is closed, with no data printed to the terminal. To update the code, you need to execute php start.php reload or php start.php restart -d.

Windows Systems

Execute windows.bat or use the command php windows.php to start, and press Ctrl+C to stop.
Windows does not support commands like stop, reload, status, reload connections, etc.
Windows also does not support daemon mode.

Resident Memory

Webman is a resident memory framework. Generally speaking, once PHP files are loaded, they reside in memory as opcode and will not be read from disk again (template files are exceptions).
Therefore, in production environments, after any business code or configuration changes, you must execute php start.php reload for changes to take effect.
If you change process-related configurations or install new Composer packages, you need to restart using php start.php restart.

For convenience during development, Webman includes a monitor custom process to monitor business file updates. When a business file is updated, it will automatically execute a reload.
This feature is only enabled when Workerman is run in debug mode (without adding -d at startup). Windows users need to execute windows.bat or php windows.php to enable this feature.

About Output Statements

In traditional PHP-FPM projects, using functions such as echo or var_dump to output data will display directly on the page, while in Webman during development (when started in debug mode), these outputs often show up in the terminal and do not appear on the page (except for outputs in template files).

Do Not Execute exit or die Statements

Executing die or exit will cause the process to exit and restart, resulting in the current request not being responded to correctly.

Do Not Execute pcntl_fork Function

Creating a process with pcntl_fork is not permitted in Webman.

Composer Component Installation

Components installed using composer require xxx/xxx require a restart to take effect.