Workerman Getting Started Tutorial ????? Workerman? thinkphp? ???? ??? ???????. ??? ???? ?????.
Workerman? ????? pcntl? event ?? libevent? ???? ???.
pcntl ?? ??:
php-5.5.20? ?? ?????. ?? ??? ??? PHP ????? ?? ????.
1. PHP ?? ??? ?? php-5.5.20/ext/pcntl/directory cd php-5.5.20/ext/pcntl/
? ?????. 2. phpize ????? ?? /usr/local/? ????? phpize ??? ?????. php-5.5.20/bin/phpize
3. ./configure --with-php-config=PHP ?? ?? ??? ?????. ?: ./configure --with-php-config=/usr/local/php- 5.5.20/bin/php-config
4. ??? ? ?? make && make install /ext/pcntl/modules/pcntl.so? ???? ???? ??? ????
5. php echo "extension=pcntl.so" >> ; /etc/php.ini (?? ???? php.ini ?? ??? ??? php --ini ??? ?????.)
6 nginx? ?? ?????. nginx -s reload
7. ??? ?? ps -aux | grep pcntl
??? 5.3?? ?? ??? ???? ??? ? ????:
yum install php-cli php-process git gcc php-devel php-pear libevent-devel php-pdo php-mysql_pdo -y
event ?? ??:
1. yum install libevent-devel -y
2. pecl ?? ???
?: libevent OpenSSL ?? ?? [yes]: no? ???? Enter? ????. ??? ??? Enter? ????
3. echo Extension=event.so > /etc/php.ini
libevent ?? ??:
1.yum install libevent-devel
2.pecl ?? ??://pecl.php.net/libevent-0.1.0 //libevent ?? ?? [?? ??]: Enter? ????
3. PHP ???? lib/php/extensions/no-debug-non-zts- libevent.so? 20121212 ???? ??? ?????? 4. ??? ?? ????? ??? php -v ??? ??????.
Workerman? Thinkphp? ?????.(??: workerman tutorial) 1. ????? Workerman ????? ???? ThinkPHPLibrary ????? ????
2. LibConstants.php? ??? Worker ????? ??? ?? ??? *.class.php? ?????.
3. ???? ?? ????? ?? ??? ???? Worker.php ??? ????.
<?php header("Content-type: text/html; charset=utf-8"); // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- // | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: liu21st <liu21st@gmail.com> // +---------------------------------------------------------------------- // 應(yīng)用入口文件 define('BIND_MODULE', 'Worker'); define('BIND_CONTROLLER', 'Worker'); define('BIND_ACTION', 'Start'); //define('APP_MODE','cli'); //ThinkPHP的其他設(shè)定 define( 'APP_PATH', dirname(__FILE__).'/Application/' ); require dirname( __FILE__).'/ThinkPHP/ThinkPHP.php'; ?>
4. ? ??? ???? ???? ??? Worker
5? ?????. ?? ??? ??? ??? ??:
<?php namespace Worker\Controller; use Think\Controller; use Workerman\Worker; class WorkerController extends Controller{ public function Start() { $worker = new Worker('text://0.0.0.0:8989'); //實例化Worker,并設(shè)置協(xié)議、IP和端口(地址和端口自定義) $worker->count = 4; $worker->onMessage = array($this, 'onMessage'); //worker的其它回調(diào)方法可以參考o(jì)nMessage Worker::runAll(); } public function onMessage($connection, $data) { $connection->send('hello'); } } ?>
6. Linux ???? ???? ?? 8989
iptables -I INPUT -p tcp --dport 8989 -j ACCEPT
7? ???. Enter ???? ?? ????? ?? ??? ?????.
php worker.php start
? ?? ??? ???? OK? ?????. ? ?? ??? ???? telnet 127.0.0.1 8989? ????
Workerman ??? MySQL? ??????. 1. pdo ? pdo_mysql ?? ?????. ?? ??
2. config.php? ?????? ?? ??? ?????. Worker ??? Conf ????
3. ?? ??? localhost? ???? ?? IP127.0.0.1? ?????.
4. ?????? ?? ? Thinkphp? ?? Db ???? ??? ? ????
? ??? thinkphp? ?? ???? ???? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

Workerman ???? ?? ??? ? ????? ????? ?? ?? ??? ?????. ??: Workerman? ???? ????? ???? ?? ??? PHP ??? ???? ?? ????????. ?? ???? ?? ??? ? ????? ???? ?? ?? ?????. ? ????? Workerman ?????? ???? ?? ??? ? ????? ???? ??? ???? ???? ?? ??? ?????. 1. ?? ???: ?? ???? ?? ???? ?? ??? ??? ???? ??? ????. ??? ?????

ThinkPHP ????? ????? ??? ?????: Composer? ????, ???? ????? ???? php bin/console? ????, ?? ???? ??? http://localhost:8000? ?????.

ThinkPHP?? ??? PHP ????? ??? ?? ??? ????. ??? ???? 3.2, 5.0, 5.1, 6.0? ????, ??? ??? ??? ???? ??? ??? ???? ? ?????. ?? ?? ??? ThinkPHP 6.0.16???. ??? ??? ? PHP ??, ?? ?? ?? ? ???? ??? ??????. ??? ??? ??? ???? ?? ?? ??? ???? ?? ????.

ThinkPHP Framework? ???? ???? ??: ThinkPHP Framework? ?? ????? ?????? ??? ???. ThinkPHP ?? ????? ???? ?? ???(?? ??)? ????. ?????? ?? ????? ?????. ? ??? ?????. ThinkPHP ??????? ??????. ThinkPHP ?????? URL? ???? ?????.

Laravel? ThinkPHP ?????? ?? ??: ThinkPHP? ????? ??? ? ??? ??? ?? Laravel?? ??? ????. Laravel? ? ????? ??? ??????? ?? ThinkPHP? ? ??? ? ????.

ThinkPHP ?? ??: PHP, Composer ? MySQL ??? ?????. Composer? ???? ????? ????. ThinkPHP ?????? ???? ?????. ?????? ??? ?????. ?????? ??? ?????. ??????? ???? http://localhost:8000? ?????.

Swoole? Workerman? ?? ??? PHP ?? ????????. ??? ??, ??? ?? ? ????? ? ??? Swoole? ?? ?? ?? ??? ?? ???? ???? ?? ????? ?????. Workerman? ?? ???? ?? ??? ??? ???? ????? ? ??? ???? API? ?? ???? ? ??? ??? ???? ?????.

ThinkPHP? ?? ????, ?? ???, ?? ?? ? ?????? ???? ?? ??? ?? ??? PHP ????????. ?? ?? ???? ??? ?? 10,000? ??? ??? ??? ? ??? JD.com, Ctrip? ?? ??? ? ??? ? ?????? ????? ?? ?? ?????? ?? ?????.
