(一).企图干活,2.在eclipse中设置svn(phpstorm能够略过)

出于专门的学问的原因,前段时间核算了一晃mac系统下常驻服务的接受websocket音信和制程的办法原理。将现实达成细节记录下来备忘。

安装进度:

(一).希图职业

1.安装eclipse或phpstorm
解压就可以

1.设置brew,在极限中输入:

2.在eclipse中装置svn(phpstorm能够略过)
地址:http://subclipse.tigris.org/update\_1.8.x

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” 

3.安装pecl
命令:
cd /usr/lib/php
sudo php install-pear-nozlib.phar
sudo cp /etc/php.ini.default /etc/php.ini
sudo vi /etc/php.ini
   修改include_path = “.:/php/includes”  –> include_path =
“.:/usr/lib/php/pear”
sudo pear channel-update pear.php.net 
sudo pecl channel-update pecl.php.net 
sudo pear upgrade-all

只顾:要是当前的用户是组织者,要求对权力进行许可,在施行上面包车型客车命令前先实践:sudo
chmod -Tiggo g+w /usr/local 

4.安装brew
命令:
ruby -e “$(curl -fsSL
https://raw.github.com/Homebrew/homebrew/go/install)”
Whoops, the Homebrew installer has moved! Please instead run:

2.安装boost

ruby -e “$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)”

(a).brew install boost

Mac 升级10.10 Yosemite系统 brew 报错不可能利用化解办法
vim /usr/local/Library/brew.rb
#!/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
-W0

(b).加多boost碰到变量,vi ~/.bash_profile

5.安装autoconf
命令:
brew install autoconf

超文件的末梢加多BOOST_LIBS=/usr/local/lib;BOOST_INCLUDES=/usr/local/include/boost;

6.安装memcached
命令:
brew search memcache
brew install memcached

3.安装openssl

Error: Failed to download resource “memcached”
wget http://memcached.org/latest
体育365网址,tar -zxvf memcached-1.x.x.tar.gz
cd memcached-1.x.x
./configure && make && make test && sudo make install

(a).下载并解压openssl

brew install libmemcached
启动:
memcached -p 11211 -m 64 -d

https://www.openssl.org/source/openssl-1.0.2l.tar.gz

开机自运营:
a.编辑可举办脚本
sudo vim /usr/bin/start-memcached
#!/bin/bash
/usr/bin/memcached -p 11211 -m 64 -d
b.修改脚本权限
sudo chmod +x /usr/bin/start-memcached
c.编辑plist
sudo vim /Library/LaunchDaemons/com.memcached.plist
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN”
http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
<plist version=”1.0″>
<dict>
    <key>Label</key>
    <string>com.memcached.plist</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/start-memcached</string>
    </array>
    <key>KeepAlive</key>
    <false/>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/tmp/memcached.err</string>
    <key>StandardOutPath</key>
    <string>/tmp/memcached.out</string>
</dict>
</plist>
d.载入plist
sudo launchctl load -w /Library/LaunchDaemons/com.memcached.plist

(b).sudo ./config –prefix=/usr/local/openssl  

7.安装php扩展
sudo pecl search memcache
sudo pecl install memcache
sudo pecl install memcached
sudo pecl search redis

(c).make;make install

sudo pecl install redis
#Mac系统晋级到10.9(mavericks)时设置php扩充难题化解
sudo ln -s
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include
/usr/include

(d).增多openssl情形变量,vi ~/.bash_profile

sudo pecl install redis

朝文件的尾巴部分加多:OPENSSL_PATH=/usr/local/opt/openssl

8安装xdebug
命令:
brew install zlib

4.下载websocketpp源代码

#Error: No available formula for zlib 

https://github.com/zaphoyd/websocketpp

brew tap homebrew/dupes

(二)websocketpp集成工程布置

brew install homebrew/dupes/xar

1.创建一个xcode command line tools工程

brew install zlib

2.设置好Herder文件,lib文件搜寻路线和连接库参数

brew install php54-xdebug

 

Error: No available formula for php54-xdebug

 

brew tap josegonzalez/homebrew-php

体育365网址 1

brew install php54-xdebug

 

9.修改/etc/php.ini
命令:
sudo vi /etc/php.ini
在文件最后扩展:
[xdebug]
zend_extension=”/usr/local/Cellar/php54-xdebug/2.2.5/xdebug.so”
xdebug.idekey=”PHPSTORM”
xdebug.remote_enable=on

 

extension=memcache.so
extension=memcached.so
extension=redis.so
修改时区:
date.timezone = Asia/Shanghai

体育365网址 2

10.通过svn导入php工程
地址:
(遵照自己的品类差别,地址差异等)

 

11.创办路径(依据实际项目路径)
mkdir /Users/san.zhang/documents/workspace_php/mojo/xxx
chmod 777 xxx

3.编纂code,并编写翻译成可实施文件

12.修改/etc/Apache2/httpd.conf
命令:
sudo vi /etc/apache2/httpd.conf
修改内容:
撤回注释:LoadModule php5_module libexec/apache2/libphp5.so
修改运转用户为实在用户:User san.zhang
修改运营组:Group wheel
修改DocumentRoot为实在项目所在目录:DocumentRoot
“/Users/san.zhang/documents/workspace_php”
修改Directory为实际项目所在目录:<Directory
“/Users/san.zhang/documents/workspace_php”>
<Directory “/Library/WebServer/Documents”>下AllowOverride None
-> AllowOverride All
另一处,假诺还十二分,则修改:Deny from all -> Allow from all

(三)创立多个 mac 的后台进度(daemon)

13.启动apache
命令:
sudo apachectl restart

1.编写plist文件

开机自运营:
sudo launchctl load -w
/System/Library/LaunchDaemons/org.apache.httpd.plist

<?xml version=”1.0″ encoding=”UTF-8″?>

14.phpstorm配置
a.菜单phpstorm-preference-Project Setting-Directories
标识当前项目标protected/runtime, assets为excluded
标识工程项指标根目录问resource root
点击Add Content
Root,把yii框架的不二等秘书诀增加进去,标识cli/views目录为excluded
b.菜单phpstorm-preference-IDE Settings-File Types
右下角的ignore files里面加多yiilite.php
c.菜单phpstorm-preference-Project Setting-PHP-servers
添加server,host:localhost,port:80,debugger:xdebug
d.菜单run-debug configurations
添加php web application,starturl=/
e.菜单phpstorm-preference-Project Setting-PHP
添加Interpreter:php5.4,路径:全部

<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN”
http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;

15.做客地址,展现游戏画面则意味正常
http://localhost/xxx

<plist version=”1.0″>

16.翻看日志:/private/var/log/apache2/

<dict>

版权注脚:本文为博主原创作品,未经博主允许不得转发。

<key>Label</key>


<string>com.liuxt.cmdservice</string>

<key>ProgramArguments</key>

<array>

<string>/Users/Shared/cmdservice</string>

</array>

<key>RunAtLoad</key>

<true/>

</dict>

</plist>

 

 

 3.将编写翻译好的command line service可实施顺序copy到

/Users/Shared/

目录下,将plist文件copy到

/Library/LaunchDaemons/目录下

 

4.重启mac台式机,能够发掘command line service程序已经运维起来了

相关文章