0%

php-pear的总结

2017年9月4日 上午8:48

我把原来windows的php项目放到Mac上时出现了pear不能正常使用的情况

解决:

  1. 现象1+现象2:​
    1. 原因:表面上看是路径上的问题,但是,本质上是我一开始使用pear的时候理解不到位,按照百度上的各种资料查查查,改改改,以后改的乱七八糟。
    2. 解决:我在pear中安装了pear install Mail,pear install Mail_Mine,pear install Net_SMTP
  2. 现象3:邮箱的代理密码过期了,重新弄一个就行了
    1. 参考的文章:PHP使用Pear发送邮件(Windows环境)

总结:

  1. 对待新的知识我当初没有理解清楚就去做了,当时也是费了千辛万苦,觉得好难,但是现在回过头去看,这么简单的东西一个就应该学会的啊,这是为什么?。
  2. 一方面来说我当时时间紧,不可能等你完全弄懂了在去操作,一方面是自己的能力还是不够,经验还是不足​。
  3. 下图就是我搞出的笑话。

  1. 我一开始就把pear理解成类库,所以就在TP手册中查怎样才能调用第三方类库,最后找到了Vendor,pear也在vendor中有一份
  2. 这样各种策论混在以前用使用pear 又使用vendor,虽然最后功能成功了,但是其实也没学下啥,脑子里一团糟,根本给别人讲不通。
  3. 总结,面对这样的问题,我们首先要看自己有没有一个思路,不要想自己当初一样,就知道熬夜,像无头苍蝇一样乱撞。在保持自己清晰的思路之后,要想到和比自己强的人请教,虚心求教,这方面我的确需要更加努力! ​

​附录:安装过程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Last login: Wed Jun 21 16:44:16 on ttys001

czhdeMacBook-Pro:~ czh$ kill -INT `cat /usr/local/var/run/php-fpm.pid`

czhdeMacBook-Pro:~ czh$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

czhdeMacBook-Pro:~ czh$ kill -INT `cat /usr/local/var/run/php-fpm.pid`

czhdeMacBook-Pro:~ czh$ echo 'export PATH="$(brew --prefix php70)/bin:$PATH"' >> ~/.bash_profile #for php

czhdeMacBook-Pro:~ czh$ echo 'export PATH="$(brew --prefix php70)/sbin:$PATH"' >> ~/.bash_profile #for php-fpm

czhdeMacBook-Pro:~ czh$ echo 'export PATH="/usr/local/bin:/usr/local/sbib:$PATH"' >> ~/.bash_profile #for other brew install soft

czhdeMacBook-Pro:~ czh$ source ~/.bash_profile

czhdeMacBook-Pro:~ czh$ php -v

PHP 7.0.14 (cli) (built: Dec 9 2016 07:34:25) ( NTS )

Copyright (c) 1997-2016 The PHP Group

Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

czhdeMacBook-Pro:~ czh$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php70.plist

/Users/czh/Library/LaunchAgents/homebrew.mxcl.php70.plist: No such file or directory

czhdeMacBook-Pro:~ czh$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php7.plist

/Users/czh/Library/LaunchAgents/homebrew.mxcl.php7.plist: No such file or directory

czhdeMacBook-Pro:~ czh$ ln -sfv /usr/local/opt/php70/*.plist ~/Library/LaunchAgents

/Users/czh/Library/LaunchAgents/homebrew.mxcl.php70.plist -> /usr/local/opt/php70/homebrew.mxcl.php70.plist

czhdeMacBook-Pro:~ czh$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php70.plist

czhdeMacBook-Pro:~ czh$ pear install Mail

WARNING: configuration download directory "/tmp/pear/install" is not writeable. Change download_dir config variable to a writeable dir to avoid this warning

WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update

Cannot install, php_dir for channel "pear.php.net" is not writeable by the current user

czhdeMacBook-Pro:~ czh$ sudo pear install Mail

Password:

WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update

Did not download optional dependencies: pear/Net_SMTP, use --alldeps to download automatically

pear/Mail can optionally use package "pear/Net_SMTP" (version >= 1.4.1)

downloading Mail-1.4.1.tgz ...

Starting to download Mail-1.4.1.tgz (21,756 bytes)

........done: 21,756 bytes

install ok: channel://pear.php.net/Mail-1.4.1

czhdeMacBook-Pro:~ czh$ sudo pear install Mail_Mine

No releases available for package "pear.php.net/Mail_Mine"

install failed

czhdeMacBook-Pro:~ czh$ sudo pear install Mail_Mime

WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update

downloading Mail_Mime-1.10.1.tgz ...

Starting to download Mail_Mime-1.10.1.tgz (36,336 bytes)

..........done: 36,336 bytes

install ok: channel://pear.php.net/Mail_Mime-1.10.1

czhdeMacBook-Pro:~ czh$ sudo pear install Net_SMTP

WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update

WARNING: "pear/Auth_SASL" is deprecated in favor of "pear/Auth_SASL2"

Did not download optional dependencies: pear/Auth_SASL, use --alldeps to download automatically

pear/Net_SMTP can optionally use package "pear/Auth_SASL" (version >= 1.0.5)

downloading Net_SMTP-1.8.0.tgz ...

Starting to download Net_SMTP-1.8.0.tgz (14,399 bytes)

.....done: 14,399 bytes

downloading Net_Socket-1.2.2.tgz ...

Starting to download Net_Socket-1.2.2.tgz (6,903 bytes)

...done: 6,903 bytes

install ok: channel://pear.php.net/Net_Socket-1.2.2

install ok: channel://pear.php.net/Net_SMTP-1.8.0