diff --git a/frameworks/PHP/php/benchmark_config.json b/frameworks/PHP/php/benchmark_config.json index 597a4f83452..e91e5e74fc8 100644 --- a/frameworks/PHP/php/benchmark_config.json +++ b/frameworks/PHP/php/benchmark_config.json @@ -183,6 +183,29 @@ "notes": "", "versus": "php" }, + "workerman": { + "json_url": "/json.php", + "plaintext_url": "/plaintext.php", + "db_url": "/dbraw.php", + "query_url": "/dbquery.php?queries=", + "fortune_url": "/fortune.php", + "update_url": "/updateraw.php?queries=", + "port": 8080, + "approach": "Realistic", + "classification": "Platform", + "database": "MySQL", + "framework": "PHP", + "language": "PHP", + "flavor": "PHP8", + "orm": "Raw", + "platform": "Workerman", + "webserver": "none", + "os": "Linux", + "database_os": "Linux", + "display_name": "php-workerman", + "notes": "Workerman without worker mode", + "versus": "php" + }, "eloquent": { "db_url": "/eloquent/db-eloquent.php", "query_url": "/eloquent/db-eloquent.php?queries=", diff --git a/frameworks/PHP/php/deploy/workerman/cli-php.ini b/frameworks/PHP/php/deploy/workerman/cli-php.ini new file mode 100644 index 00000000000..26d9ec62331 --- /dev/null +++ b/frameworks/PHP/php/deploy/workerman/cli-php.ini @@ -0,0 +1,16 @@ +opcache.enable=1 +opcache.enable_cli=1 +opcache.validate_timestamps=0 +opcache.save_comments=0 +opcache.enable_file_override=1 +opcache.memory_consumption=256 +opcache.interned_strings_buffer=16 +opcache.huge_code_pages=1 + +mysqlnd.collect_statistics = Off +memory_limit = 512M + +opcache.jit_buffer_size=128M +opcache.jit=tracing + +disable_functions=header,header_remove,headers_sent,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,set_time_limit \ No newline at end of file diff --git a/frameworks/PHP/php/deploy/workerman/composer.json b/frameworks/PHP/php/deploy/workerman/composer.json new file mode 100644 index 00000000000..263325313aa --- /dev/null +++ b/frameworks/PHP/php/deploy/workerman/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "joanhey/adapterman": "0.5" + } + } \ No newline at end of file diff --git a/frameworks/PHP/php/deploy/workerman/start.php b/frameworks/PHP/php/deploy/workerman/start.php new file mode 100644 index 00000000000..1bdc84945b9 --- /dev/null +++ b/frameworks/PHP/php/deploy/workerman/start.php @@ -0,0 +1,77 @@ +count = (int) shell_exec('nproc') * 4; +$web->name = 'workerman'; + +define('WEBROOT', '/php/'); + +$web->onWorkerStart = static function () { + Header::init(); +}; + +$web->onMessage = static function ($connection, $request) { + $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); + /* if ($path === '/') { + $connection->send(exec_php_file(WEBROOT.'/index.php', $request)); + return; + } */ + + $file = realpath(WEBROOT . $path); + if (false === $file || !str_ends_with($file, '.php')) { + http_response_code(404); + $connection->send('