????? ????? Nginx/Apache? ?? ??? ????? ???? client/index.html? ???? ? ??? ???. IP? ??? ?? ??? ??? client/config.js? ?????. php webim_server.php ??? ?? ?? 1. ??? ??(php ??? ??? ??)
curl -sS https://getcomposer.org/installer | php mv ???.phar /usr/local/bin/composer ??: ??? ?? ?? PHP ????? ????? ?? ?? PATH? ???? ???? ???? ???. ??? ??? ? ?? ?? #!/usr/bin/env php??? ??? ? ????.
2.composer install
PHPWebIM ???? ????? ???? ??? ?? ??? ?????. ??? ?? ?? ??
composer install --prefer-dist 3.Ningx/Apache ??(swoole_framework?? ???? Web AppServer? ???? ???? ??)
nginx
server { listen 80; server_name im.swoole.com; index index.shtml index.html index.htm index.php; root /path/to/PHPWebIM/client; location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } access_log /Library/WebServer/nginx/logs/im.swoole.com access; }
apache
<VirtualHost *:80> DocumentRoot "path/to/PHPWebIM/client" ServerName im.swoole.com AddType application/x-httpd-php .php <Directory /> Options Indexes FollowSymLinks AllowOverride None Require all granted DirectoryIndex index.php </Directory> </VirtualHost>
4. ?? ?? PHPWebIM/config.php
$config['server'] = array( //監(jiān)聽的HOST 'host' => '0.0.0.0', //監(jiān)聽的端口 'port' => '9503', //WebSocket的URL地址,供瀏覽器使用的 'url' => 'ws://127.0.0.1:9503', );
server.host server.port ??? WebIM ??, ? WebSocket? IP ? ?????. ?? ??? ?? ??? ?? server.url? ?????. ?? IP ?? ??? ??? ??? ???? ??? ???? ? ?????. ?? ??? ???? ???????.
5. WebSocket ?? ?? php PHPWebIM/webim_server.php IE ????? WebSocket? ???? ???? flash_policy?? ?? ??? ???? ???. php? ??? ?? flash_policy.php? ?????. php PHPWebIM/flash_policy.php 6. ??? ??? ? ?? ? ???(?? ??) URL? IP:PORT? ?? ???? ?? ????? ??? ???? ????. vi /etc/hosts 127.0.0.1 ?? im.swoole.com ????? ??: http://im.swoole.com
精品PHP中高級進(jìn)階學(xué)習(xí)教程,需要加微信:PHPopen888,還可加入微信群,分享tp,laravel,swoole等...