Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75c2e6c

Browse files
committed
Merge pull request #19 from kk580kk/master
Changes to be committed:
2 parents 700aecd + c073fd0 commit 75c2e6c

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

php.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# php开发环境设置
2+
3+
### hombrew
4+
5+
``` sh
6+
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
7+
```
8+
9+
可能需要翻墙,大概率需要`shadowsock`或者其他翻墙工具加上`proxychain-ng`可以做到翻墙使用homebrew。
10+
11+
### php环境
12+
13+
虽然Mac OS X 自带了php,但是我们可以选择使用Homebrew安装php56或者php54因为:
14+
15+
- 使用Homebrew安装更新的php版本
16+
- 同时安装5.6和5.5和5.4的php
17+
- Homebrew会同时安装xdebug和mcrypt等工具
18+
19+
安装python 56:
20+
21+
```
22+
brew install homebrew/php/php56
23+
brew install homebrew/php/php56-mcrypt
24+
brew install homebrew/php/php56-xdebug
25+
```
26+
27+
安装python 5.4:
28+
29+
```
30+
brew install homebrew/php/php54
31+
```
32+
33+
一般来说如果php安装了xdebug,大概率composer运行的时候会报错。所以用来运行脚本的php不能安装xdebug。可以这样把已经安装了xdebug调试工具的php从`PATH`中移除。
34+
35+
``` sh
36+
brew unlink php56
37+
```
38+
39+
### composer
40+
41+
##### 英文原版安装(需要翻墙)
42+
43+
参考网址https://getcomposer.org/doc/00-intro.md
44+
45+
You can place the Composer PHAR anywhere you wish. If you put it in a directorythat is part of your `PATH`, you can access it globally. On unixy systems youcan even make it executable and invoke it without directly using the `php`interpreter.
46+
47+
Run these commands to globally install `composer` on your system:
48+
49+
``` sh
50+
curl -sS https://getcomposer.org/installer | php
51+
mv composer.phar /usr/local/bin/composer
52+
```
53+
54+
A quick copy-paste version including sudo:
55+
56+
``` sh
57+
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
58+
```
59+
60+
##### 中文镜像库安装
61+
62+
参考网址http://docs.phpcomposer.com/00-intro.html
63+
64+
如果你把它放在系统的 `PATH` 目录中,你就能在全局访问它。 在类Unix系统中,你甚至可以在使用时不加 `php` 前缀。
65+
66+
你可以执行这些命令让 `composer` 在你的系统中进行全局调用:
67+
68+
``` sh
69+
curl -sS https://getcomposer.org/installer | php
70+
mv composer.phar /usr/local/bin/composer
71+
```
72+
73+
**注意:** 如果上诉命令因为权限执行失败,请使用 sudo 再次尝试运行 `mv` 那行命令。
74+
75+
或者
76+
77+
检查一些 PHP 的设置,然后下载 `composer.phar` 到你的工作目录中。这是 Composer 的二进制文件。这是一个 PHAR 包(PHP 的归档),这是 PHP 的归档格式可以帮助用户在命令行中执行一些操作。
78+
79+
你可以通过 `--install-dir` 选项指定 Composer 的安装目录(它可以是一个绝对或相对路径):
80+
81+
``` sh
82+
curl -sS https://getcomposer.org/installer | php -- --install-dir=bin
83+
```
84+

0 commit comments

Comments
 (0)