涓�锛屽畨瑁卙omebrew
灏卞儚linux涓嬮潰鏈墆um涓�鏍凤紝mac涔熸湁涓猦omebrew锛岀鐞嗚蒋浠堕潪甯镐究鎹枫��
瀹樼綉锛歨ttp://brew.sh/index_zh-cn.html
涓婇潰鏈夊彞鍛戒护锛屽鍒朵笅鏉ョ粓绔墽琛岋紝濡傛灉鍛戒护杩斿洖404娌℃壘鍒帮紝鍛戒护浠ュ畼缃戞渶鏂颁负鍙傝�冦��
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
浠绘剰閿户缁紝鍙兘闇�瑕佽緭鍏ヤ綘MAC鐨勫紑鏈哄瘑鐮�
婕暱鐨勭瓑寰呫�傘�傘�傚彲浠ュ幓娲椾釜婢′簡鍐嶅洖鏉ョ湅
brew help鍙互鐪嬪府鍔�
浜岋紝瀹夎nginx
brew install nginx #閲嶆柊鍔犺浇閰嶇疆|閲嶅惎|鍋滄|閫�鍑� nginx nginx -s reload|reopen|stop|quit #娴嬭瘯閰嶇疆鏄惁鏈夎娉曢敊璇� nginx -t
鍙堟槸婕暱鐨勭瓑寰�
nginx -v 鏌ョ湅鐗堟湰
鎵撳紑 nginx 鍚庯紝榛樿鐨勮闂鍙� 8080锛屽鏋滆鏀逛负甯哥敤鐨� 80 绔彛锛屽垯瑕佷慨鏀� "/usr/local/etc/nginx/nginx.conf" 涓嬬洃鍚�(listen)绔彛鍊笺��
榛樿鐨勬枃浠惰闂洰褰�(root)鏄� "/usr/local/Cellar/nginx/1.8.0/html"锛堣繖閲岀殑1..8.0鏄畨瑁呯殑nginx鐨勭増鏈紝鏂囦欢澶瑰悕浠ュ畨瑁呯殑nginx鐗堟湰涓哄噯锛夈��
鎶� nginx 璁剧疆涓哄紑鏈哄惎鍔ㄨ繍琛岋細
mkdir -p ~/Library/LaunchAgents cp /usr/local/Cellar/nginx/1.8.0/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
涓嶈繃璇曚簡涓�涓嬶紝涓嶆槸瓒呯骇鐢ㄦ埛鐧婚檰锛岃�屾槸鏅�氱敤鎴风櫥闄嗭紝骞朵笖鐩戝惉鐨勭鍙e湪1024浠ヤ笅鐨勶紙渚嬪鎶婇粯璁ょ殑8080绔彛鏀逛负浜�80绔彛锛夛紝nginx 寮�鏈烘槸鍚姩涓嶄簡銆傚洜姝わ紝瑕� nginx 寮�鏈哄惎鍔ㄧ殑璇濓紝闇�瑕佺粰浜堝畠绠$悊鍛樻潈闄愶細
sudo chown root:wheel /usr/local/Cellar/nginx/1.8.0/bin/nginx sudo chmod u+s /usr/local/Cellar/nginx/1.8.0/bin/nginx
浜岋紝瀹夎mysql
brew install mysql
瀹夎瀹屼箣鍚庣櫥闄嗭紝鎶ヤ簡涓敊锛孧ySQL server through socket '/tmp/mysql.sock
鍚姩涓�涓媘ysql锛屽湪璇曚竴涓�
mysql.server restart
濡傛灉瑙夊緱寰堥夯鐑︺�傜洿鎺ュ埌瀹樼綉涓嬩釜mac鐨刣mg鐗坢ysql鍚�
璁板緱鍗歌浇 brew remove mysql 锛�
涓嬭浇mysql瀹樼綉鐨刴ac dmg鐗堝畨瑁呭嵆鍙紝瀹夎瀹屼箣鍚庯紝鍦ㄥ亸濂借缃噷闈細鍑虹幇mysql鐨勫浘鏍囷紝鍜宩ava锛宖lash涓�鏍凤紝鎵撳紑鐪嬩笅锛屼笅闈㈢殑鍕鹃�夊紑鏈哄惎鍔�
cd ; nano .bash_profil
鎵撳紑缂栬緫杩欎釜鏂囦欢
export PATH="/usr/local/mysql/bin:$PATH"
control+x 鍚庡洖杞﹂��鍑�
source ~/.bash_profile
mysql鐧婚檰锛屽鏋滈亣鍒�
-bash: mysql: command not found
鍘熷洜:杩欐槸鐢变簬绯荤粺榛樿浼氭煡鎵�/usr/bin涓嬬殑鍛戒护锛屽鏋滆繖涓懡浠や笉鍦ㄨ繖涓洰褰曚笅锛屽綋鐒朵細鎵句笉鍒板懡浠わ紝鎴戜滑闇�瑕佸仛鐨勫氨鏄槧灏勪竴涓摼鎺ュ埌/usr/bin鐩綍涓嬶紝鐩稿綋浜庡缓绔嬩竴涓摼鎺ユ枃浠躲��
棣栧厛寰楃煡閬搈ysql鍛戒护鎴杕ysqladmin鍛戒护鐨勫畬鏁磋矾寰勶紝姣斿mysql鐨勮矾寰勬槸锛�/usr/local/mysql/bin/mysql锛屾垜浠垯鍙互杩欐牱鎵ц鍛戒护锛�
# ln -s /usr/local/mysql/bin/mysql /usr/bin
璁剧疆浣犵殑瀵嗙爜
/usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'
mysql -uroot -pyourpasswordhere
鐧婚檰鎴愬姛锛�
涓夈�佸畨瑁卲hp-fpm
Mac鏄瑁呬簡php锛屼笉杩囧緢澶氭墿灞曢兘娌″畨瑁咃紝鐩祴鏈�澶氬彧鑳藉湪缁堢閲屾墽琛屼笅php鎸囦护锛屾墍浠ユ垜閫夋嫨閲嶆柊瀹夎php銆傜敱浜� brew 榛樿鏄病鏈� php 瀹夎锛屾墍浠ヨ浣跨敤 “brew tap” 鏉ュ畨瑁� brew 鐨勭涓夋柟绋嬪簭鍖咃紝杩欓噷浣跨敤 josegonzalez 鐨刾hp瀹夎鍖咃紝鍏蜂綋鎿嶄綔濡備笅锛�
1
2
|
brew tap homebrew
/dupes
brew tap josegonzalez
/homebrew-php
|
鎵ц瀹屽悗锛屽氨鍙互鐢� brew 瀹夎php浜嗐�傝繖閲宲hp鏈夊嚑涓増鏈彲浠ュ畨瑁咃紝鍏蜂綋鍙互鎵ц "brew search php" 鏌ョ湅涓�涓嬫湁浠�涔坧hp鐗堟湰鍙互瀹夎锛屼竴鑸細鏈�“php52銆乸hp53銆乸hp54”鐗堟湰锛屾垜瀹夎鐨勬槸鏈�鏂扮殑php5.6鐗堟湰銆�(php7.0灏濊瘯澶氭缂栬瘧涓嶈繃鍘绘斁寮冧簡銆�)
鐢变簬PHP5.4浠ヤ笂鐗堟湰宸茬粡鍐呭祵浜� FPM锛孎astCGI Process Manager锛�锛屽湪瀹夎閫夐」閲屾爣鏄庡氨琛岋紝鏈汉 php 鐨勫畨瑁呴厤缃寚浠ゅ涓嬶細
brew install php56 --with-debug --with-homebrew-curl --with-imap --with-homebrew-libressl --with-homebrew-libxslt --with-libmysql --without-apache --with-fpm
瀹夎瀹屽悗浼氬嚭涓�娈垫彁绀虹殑銆�
The php.ini file can be found in: /usr/local/etc/php/5.6/php.ini 鉁┾湬鉁┾湬 Extensions 鉁┾湬鉁┾湬 If you are having issues with custom extension compiling, ensure that you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH: PATH="/usr/local/bin:$PATH" //杩欎釜鏀惧湪鐜鍙橀噺鏂囦欢~/bash_profile鐨�/usr/sbin/鐨勫墠闈紝浼樺厛閫夋嫨brew鐨刾hp PHP56 Extensions will always be compiled against this PHP. Please install them using --without-homebrew-php to enable compiling against system PHP. 鉁┾湬鉁┾湬 PHP CLI 鉁┾湬鉁┾湬 If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc, ~/.zshrc, ~/.profile or your shell's equivalent configuration file: export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH" //鍛戒护琛屾墽琛屽悗鎵嶈兘php -v鏌ョ湅鏈�鏂扮殑php瀹夎鐨勭増鏈� 鉁┾湬鉁┾湬 FPM 鉁┾湬鉁┾湬
To launch php-fpm on startup: mkdir -p ~/Library/LaunchAgents //鍒涘缓鐩綍锛屾湁鍒欏拷鐣� cp /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/ //澶嶅埗鏂囦欢鍒扮郴缁熺洰褰� launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist //鎵ц鍚� 寮�鏈哄惎鍔╬hp-fpm The control script is located at /usr/local/opt/php56/sbin/php56-fpm OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH: PATH="/usr/local/sbin:$PATH" //鏇存柊瀹夎锛屾湁鍒欏拷鐣ワ紝娌℃湁鍒欏姞鍒皛/.bash_profile You may also need to edit the plist to use the correct "UserName". Please note that the plist was called 'homebrew-php.josegonzalez.php56.plist' in old versions of this formula. To have launchd start josegonzalez/php/php56 at login: ln -sfv /usr/local/opt/php56/*.plist ~/Library/LaunchAgents //浣跨敤php Then to load josegonzalez/php/php56 now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php56.plist //浣跨敤php ==> Summary 馃嵑 /usr/local/Cellar/php56/5.6.14: 309 files, 43M, built in 5.9 minutes
鏇村鐨勫畨瑁呴�夐」鍙互閫氳繃 "brew options php56" 鏌ョ湅銆傛寚浠ゆ墽琛屽畬鍚庯紝php 璺� php-fpm 灏卞畨瑁呭ソ浜嗐��
鐢变簬鏄噸瑁卲hp锛屼箣鍓嶇郴缁熼瑁呯殑php杩樻病鍗歌浇锛屽洜姝ゅ湪缁堢璋冪敤php鏃讹紝杩樻槸浠ヤ箣鍓嶇郴缁熺殑php鐗堟湰鍋氳В鏋愶紝鎵�浠ヨ繖閲岄渶瑕佷慨鏀筽ath锛屾寚瀹� php 鐨勮В鏋愯矾寰勩�傚湪~/.bash_profile锛堟病鏈夊垯鍒涘缓锛夋渶鍚庡姞鍏ヤ竴琛岋細
鍏跺疄鎻愮ず宸茬粡璇寸殑寰堟竻妤氫簡銆傛寜姝ラ鍘绘暡涓婇潰鏍囩孩鐨勫懡浠ゅ氨琛屼簡銆備笅闈㈡槸鎴戠殑鐜鍙橀噺鏂囦欢 ~/.bash_profile
1
|
export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH" export PATH="/usr/local/sbin:$PATH" export PATH="/usr/local/mysql/bin:$PATH" 娣诲姞涔嬪悗鍐嶆墽琛屼竴涓媠ource锛屼娇涔嬬敓鏁� |
1
|
source ~/.bash_profile
|
銆�銆�銆�銆�銆�銆�souce 鏈夊彲鑳藉け璐ワ紝涓嶇敤绠″畠锛屽簲璇ユ槸鏈嶅姟娌¤捣鏉ャ��
OK锛宲hp-fpm瀹夎瀹屾垚銆�
褰撶劧杩樻病瀹岋紝浣犻渶瑕佸憡璇塶ginx浣跨敤php-fpm缂栬瘧php鏂囦欢銆�
vi /usr/local/etc/nginx/nginx.conf
location ~ \.php$ {
root /usr/local/var/www;#鏀逛竴涓嬩綘鐨勭綉绔欐牴鐩綍
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #杩欓噷/script鏀规垚$document_root
include fastcgi_params;
}
========================================
閰嶇疆涓�涓猯ocalhost:8081鐨勯」鐩紝/User/XXX/www/test.com
涓嬮潰鏄竴涓畝鍗曠殑閰嶇疆
server { listen 8081; server_name localhost root /Users/lixianghui/www/test.com; index index.php index.html; location ~ \.php$ { root /Users/lixianghui/www/test.com; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
鍥涖�亁debug
brew install xdebug 鍚勭鎶ラ敊锛屾病鎵惧埌tap涔嬬被鐨勶紝缃戜笂鎵句簡寰堝鏂规锛屾病瑙e喅銆�
鎵�浠ユ墦绠楃洿鎺ョ紪璇憍debug濂戒簡銆�
鎵�浠ョ洿鎺ュ畼缃慼ttp://xdebug.org/download.php
閫夋嫨 source files/xdebug-2.3.3.tgz 涓嬭浇涓嬫潵
涓㈠埌/User/XXX/www/xdebug-2.3.3.tgz
瑙e帇
tar -xzf xdebug-2.3.3.tgz
cd xdebug-2.3.3
phpize
濡傛灉鎶ラ敊娌″畨瑁卆utoconf鐨勮瘽灏� 鎵ц brew install autoconf
./configure --enable-xdebug
make
娴嬭瘯涓�涓�
make test
make install
php --ini 鎵惧埌php.ini鏂囦欢浣嶇疆
php.ine鏈熬鍔犲叆
[xdebug]
;zend_extension="/usr/local/Cellar/php56/5.6.14/lib/php/extensions/debug-non-zts-20131226/xdebug.so"
zend_extension="xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
鍙傝�冿細http://blog.csdn.net/iamduoluo/article/details/38346291
http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/#mysql
http://www.it165.net/os/html/201401/7076.html