-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1280 lines (905 loc) · 44.6 KB
/
index.html
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<title>Grow With Time</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description">
<meta property="og:type" content="website">
<meta property="og:title" content="Grow With Time">
<meta property="og:url" content="http://xuchuyuan.github.io/index.html">
<meta property="og:site_name" content="Grow With Time">
<meta property="og:description">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Grow With Time">
<meta name="twitter:description">
<link rel="alternative" href="/atom.xml" title="Grow With Time" type="application/atom+xml">
<link rel="icon" href="/favicon.png">
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<div id="container">
<div class="left-col">
<div class="overlay"></div>
<div class="intrude-less">
<header id="header" class="inner">
<a href="/" class="profilepic">
<img lazy-src="/assert/avatar.jpg" class="js-avatar">
</a>
<hgroup>
<h1 class="header-author"><a href="/">chuyuan.xu</a></h1>
</hgroup>
<p class="header-subtitle">一步一步向上爬</p>
<div class="switch-btn">
<div class="icon">
<div class="icon-ctn">
<div class="icon-wrap icon-house" data-idx="0">
<div class="birdhouse"></div>
<div class="birdhouse_holes"></div>
</div>
<div class="icon-wrap icon-ribbon hide" data-idx="1">
<div class="ribbon"></div>
</div>
<div class="icon-wrap icon-link hide" data-idx="2">
<div class="loopback_l"></div>
<div class="loopback_r"></div>
</div>
</div>
</div>
<div class="tips-box hide">
<div class="tips-arrow"></div>
<ul class="tips-inner">
<li>Menu</li>
<li>Tags</li>
<li>Links</li>
</ul>
</div>
</div>
<div class="switch-area">
<div class="switch-wrap">
<section class="switch-part switch-part1">
<nav class="header-menu">
<ul>
<li><a href="/">主页</a></li>
<li><a href="/archives">所有文章</a></li>
<li><a href="/about">关于我</a></li>
</ul>
</nav>
<nav class="header-nav">
<div class="social">
<a class="github" target="_blank" href="https://github.com/xuchuyuan" title="github">github</a>
<a class="weibo" target="_blank" href="http://weibo.com/xuchuyuan" title="weibo">weibo</a>
<a class="douban" target="_blank" href="http://www.douban.com/people/73062008/" title="douban">douban</a>
<a class="zhihu" target="_blank" href="https://www.zhihu.com/people/xuchuyuan" title="zhihu">zhihu</a>
</div>
</nav>
</section>
<section class="switch-part switch-part2">
<div class="widget tagcloud" id="js-tagcloud">
<a href="/tags/Composer/" style="font-size: 15px;">Composer</a> <a href="/tags/Git/" style="font-size: 10px;">Git</a> <a href="/tags/LINUX/" style="font-size: 10px;">LINUX</a> <a href="/tags/MySQL/" style="font-size: 10px;">MySQL</a> <a href="/tags/Nginx/" style="font-size: 10px;">Nginx</a> <a href="/tags/PHP/" style="font-size: 20px;">PHP</a>
</div>
</section>
<section class="switch-part switch-part3">
<div id="js-friends">
<a target="_blank" class="main-nav-link switch-friends-link" href="http://mdba.cn/">DBA的卢浮宫</a>
</div>
</section>
</div>
</div>
</header>
</div>
</div>
<div class="mid-col">
<nav id="mobile-nav">
<div class="overlay">
<div class="slider-trigger"></div>
<h1 class="header-author js-mobile-header hide">chuyuan.xu</h1>
</div>
<div class="intrude-less">
<header id="header" class="inner">
<div class="profilepic">
<img lazy-src="/assert/avatar.jpg" class="js-avatar">
</div>
<hgroup>
<h1 class="header-author">chuyuan.xu</h1>
</hgroup>
<p class="header-subtitle">一步一步向上爬</p>
<nav class="header-menu">
<ul>
<li><a href="/">主页</a></li>
<li><a href="/archives">所有文章</a></li>
<li><a href="/about">关于我</a></li>
<div class="clearfix"></div>
</ul>
</nav>
<nav class="header-nav">
<div class="social">
<a class="github" target="_blank" href="https://github.com/xuchuyuan" title="github">github</a>
<a class="weibo" target="_blank" href="http://weibo.com/xuchuyuan" title="weibo">weibo</a>
<a class="douban" target="_blank" href="http://www.douban.com/people/73062008/" title="douban">douban</a>
<a class="zhihu" target="_blank" href="https://www.zhihu.com/people/xuchuyuan" title="zhihu">zhihu</a>
</div>
</nav>
</header>
</div>
</nav>
<div class="body-wrap">
<article id="post-Yum" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2017/03/01/Yum/" class="article-date">
<time datetime="2017-03-01T15:16:10.000Z" itemprop="datePublished">2017-03-01</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2017/03/01/Yum/">Question - Yum No module named yum</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h4 id="No-module-named-yum"><a href="#No-module-named-yum" class="headerlink" title="No module named yum"></a>No module named yum</h4><h5 id="不知道centOS什么时候更新过yum,今天执行yum-intall,居然报问题了。"><a href="#不知道centOS什么时候更新过yum,今天执行yum-intall,居然报问题了。" class="headerlink" title="不知道centOS什么时候更新过yum,今天执行yum intall,居然报问题了。"></a>不知道centOS什么时候更新过yum,今天执行yum intall,居然报问题了。</h5><pre><code class="shell">There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.8 (default, Dec 12 2016, 11:07:53)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
</code></pre>
<p>在网上找了很久,都说是Python和yum版本不匹配,我现在的环境,Python有两个版本,v2.6.6,v2.7.8,当前Python运行环境的版本是2.7.8,yum的版本是</p>
<pre><code>rpm -qa | grep yum
yum-plugin-security-1.1.30-37.el6.noarch
yum-3.2.29-75.el6.centos.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-utils-1.1.30-37.el6.noarch
yum-plugin-fastestmirror-1.1.30-37.el6.noarch
</code></pre><p>按道理yum版本没问题,也按照网上的办法,改了/usr/bin/yum的头声明</p>
<pre><code>#!/usr/bin/python
->
#!/usr/bin/python2.6
</code></pre><p>运行yum还是不行,报同样的问题。</p>
<h4 id="推测问题"><a href="#推测问题" class="headerlink" title="推测问题"></a>推测问题</h4><p>推测估计是升级Python2.7.8的时候,原来Python2.6下的包被删了,导致无法运行。重新强制安装一遍所需要的rpm包</p>
<pre><code class="yum.sh">#!/bin/bash
URL= http://mirror.centos.org/centos/6/os/x86_64/Packages/
for package in \
python-devel-2.6.6-64.el6.x86_64.rpm \
python-iniparse-0.3.1-2.1.el6.noarch.rpm \
python-setuptools-0.6.10-3.el6.noarch.rpm \
python-urlgrabber-3.9.1-11.el6.noarch.rpm \
rpm-python-4.8.0-55.el6.x86_64.rpm \
yum-3.2.29-73.el6.centos.noarch.rpm \
yum-3.2.29-73.el6.centos.src.rpm \
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm \
do
\'rpm -Uvh --replacepkgs $URL$package --force\'
done
</code></pre>
<p>重装完毕以后运行yum可以正常运行了。</p>
<p>参考: <a href="http://www.phpvim.net/journal/centos-repair-yum-service.html" target="_blank" rel="external">http://www.phpvim.net/journal/centos-repair-yum-service.html</a></p>
</div>
<div class="article-info article-info-index">
<div class="article-tag tagcloud">
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/LINUX/">LINUX</a></li></ul>
</div>
<div class="article-category tagcloud">
<a class="article-category-link" href="/categories/Question/">Question</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</article>
<article id="post-MySQL-Install" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2016/07/22/MySQL-Install/" class="article-date">
<time datetime="2016-07-22T02:00:00.000Z" itemprop="datePublished">2016-07-22</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/07/22/MySQL-Install/">MySQL5.7.13 源码非编译安装</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>###<a href="http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz" target="_blank" rel="external">MySQL5.7下载地址</a></p>
<h5 id="前提:阿里云服务器是CentOS6-5版本,下载的时候看清楚Select-Platform,新的MySQL有600M,比之前多出一倍。"><a href="#前提:阿里云服务器是CentOS6-5版本,下载的时候看清楚Select-Platform,新的MySQL有600M,比之前多出一倍。" class="headerlink" title="前提:阿里云服务器是CentOS6.5版本,下载的时候看清楚Select Platform,新的MySQL有600M,比之前多出一倍。"></a>前提:阿里云服务器是CentOS6.5版本,下载的时候看清楚Select Platform,新的MySQL有600M,比之前多出一倍。</h5><ul>
<li><p>下载MySQL,完成解压,解压后将文件夹移到/usr/local/下<br>#####有人推荐axel下载多线程,支持断点,但是centos下没有,需要下载成yum插件,debian系统可以直接安装。尝试下载,没有反应,可能国外服务器不稳定吧,以后再试。</p>
<pre><code class="bash">wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
tar -zxvf mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.7.13-linux-glibc2.5-x86_64 /usr/local/
</code></pre>
<p>#####Tips:如果下载速度很慢,我是本地迅雷下载完成后通过scp方式上传到阿里云的,上传了20分钟。</p>
</li>
<li><p>在/usr/local/下新建一个软连接,这样以后可以安装多个MySQL实例</p>
<pre><code class="bash">ln -s mysql-5.7.13-linux-glibc2.5-x86_64 mysql
</code></pre>
</li>
<li><p>新增MySQL用户和组,一般都存在,除非服务器是新的,之前没装过MySQL 设置mysql文件夹的权限组是root<br>```<br>groupadd mysql<br>useradd mysql -g mysql</p>
</li>
</ul>
<p>cd /usr/local/mysql<br>chowm -R root:mysql mysql .</p>
<pre><code>
- 下面是关键的一步,设置my.cnf,删除原先的配置文件
```bash
unlink /etc/my.cnf
</code></pre><p>新的my.cnf 放进/etc/下</p>
<pre><code class="bash">[client]
user=test
password=abcd1234_
[mysqld]
########basic settings########
server-id = 11
port = 3306
user = mysql
bind_address = 10.0.0.1
autocommit = 0
character_set_server=utf8mb4
skip_name_resolve = 1
max_connections = 800
max_connect_errors = 1000
datadir = /data/mysql_data
transaction_isolation = READ-COMMITTED
explicit_defaults_for_timestamp = 1
join_buffer_size = 134217728
tmp_table_size = 67108864
tmpdir = /tmp
max_allowed_packet = 16777216
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
interactive_timeout = 1800
wait_timeout = 1800
read_buffer_size = 16777216
read_rnd_buffer_size = 33554432
sort_buffer_size = 33554432
########log settings########
log_error = error.log
slow_query_log = 1
slow_query_log_file = slow.log
log_queries_not_using_indexes = 1
log_slow_admin_statements = 1
log_slow_slave_statements = 1
log_throttle_queries_not_using_indexes = 10
expire_logs_days = 90
long_query_time = 2
min_examined_row_limit = 100
########replication settings########
master_info_repository = TABLE
relay_log_info_repository = TABLE
log_bin = bin.log
sync_binlog = 1
gtid_mode = on
enforce_gtid_consistency = 1
log_slave_updates
binlog_format = row
relay_log = relay.log
relay_log_recovery = 1
binlog_gtid_simple_recovery = 1
slave_skip_errors = ddl_exist_errors
########innodb settings########
innodb_page_size = 8192
innodb_buffer_pool_size = 512M
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_lru_scan_depth = 2000
innodb_lock_wait_timeout = 5
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_flush_method = O_DIRECT
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
#innodb_log_group_home_dir = /redolog/
#innodb_undo_directory = /undolog/
innodb_undo_logs = 128
innodb_undo_tablespaces = 3
innodb_flush_neighbors = 0
innodb_log_file_size = 1G
innodb_log_buffer_size = 16777216
innodb_purge_threads = 4
innodb_large_prefix = 1
innodb_thread_concurrency = 64
innodb_print_all_deadlocks = 1
innodb_strict_mode = 1
innodb_sort_buffer_size = 67108864
########semi sync replication settings########
plugin_dir=/usr/local/mysql/lib/plugin
plugin_load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
loose_rpl_semi_sync_master_enabled = 1
loose_rpl_semi_sync_slave_enabled = 1
loose_rpl_semi_sync_master_timeout = 5000
[mysqld-5.7]
innodb_buffer_pool_dump_pct = 40
innodb_page_cleaners = 4
innodb_undo_log_truncate = 1
innodb_max_undo_log_size = 2G
innodb_purge_rseg_truncate_frequency = 128
binlog_gtid_simple_recovery=1
log_timestamps=system
transaction_write_set_extraction=MURMUR32
show_compatibility_56=on
</code></pre>
<p>#####有几个注意的参数</p>
<pre><code class="bash">bind_address = 10.0.0.1 自己服务器的ip地址
datadir = /data/mysql_data MySQL数据存放文件夹 在root下新建一个data文件夹 里面什么都不要
#innodb_log_group_home_dir = /redolog/ 这两行注释掉,不需要,如果没这两目录 会报错
#innodb_undo_directory = /undolog/
</code></pre>
<ul>
<li>初始化Mysql,完成后在datadir下有MySQL的库和相关文件(重要的有slow.log,error.log)<pre><code class="bash">cd /usr/local/mysql
bin/mysql --initialize
</code></pre>
</li>
<li><p>如果初始化成功,会看到如下文件<br><img src="http://7xo7qs.com1.z0.glb.clouddn.com/mysql_data.png" alt=""></p>
</li>
<li><p>如果不是以上文件,则初始化失败,查看error.log,具体分析,虽然有时候网上的回答也解决不了,只能具体问题具体分析</p>
<h5 id="我当时也是报错了,试了很久都不行,直接把整个阿里云恢复了,还是不行,最后还是配置文件出了问题。"><a href="#我当时也是报错了,试了很久都不行,直接把整个阿里云恢复了,还是不行,最后还是配置文件出了问题。" class="headerlink" title="我当时也是报错了,试了很久都不行,直接把整个阿里云恢复了,还是不行,最后还是配置文件出了问题。"></a>我当时也是报错了,试了很久都不行,直接把整个阿里云恢复了,还是不行,最后还是配置文件出了问题。</h5></li>
<li><p>最后一步了,把启动项放到/etc/init.d下 这样就能直接启动了(可以命名相同 也可以不同 启动名称而已)</p>
<pre><code class="bash">cd /usr/local/mysql
mv support-files/mysql.server /etc/init.d/mysql.server
</code></pre>
</li>
<li><p>尝试启动MySQL,启动成功。可以连接了 回车输入初始密码<br>#####MySQL5.7初始化成功后是有默认密码的,这和之前的版本都不一样,初始密码在error.log中,就是最后那一串字符<br><img src="http://7xo7qs.com1.z0.glb.clouddn.com/initpwd.png" alt=""><br>```bash<br>/etc/init.d/mysql.server start<br>Starting MySQL.. [ OK ]</p>
</li>
</ul>
<p>/usr/local/mysql/bin/mysql -uroot -p<br>```</p>
</div>
<div class="article-info article-info-index">
<div class="article-tag tagcloud">
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/MySQL/">MySQL</a></li></ul>
</div>
<div class="article-category tagcloud">
<a class="article-category-link" href="/categories/TECH/">TECH</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</article>
<article id="post-Hexo" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2016/03/17/Hexo/" class="article-date">
<time datetime="2016-03-17T07:41:21.000Z" itemprop="datePublished">2016-03-17</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/03/17/Hexo/">搭建Hexo</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<p>Welcome to <a href="http://hexo.io/" target="_blank" rel="external">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/zh-cn/docs/index.html" target="_blank" rel="external">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="http://hexo.io/docs/troubleshooting.html" target="_blank" rel="external">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="external">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><pre><code class="bash">$ hexo new "My New Post"
</code></pre>
<p>More info: <a href="http://hexo.io/docs/writing.html" target="_blank" rel="external">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><pre><code class="bash">$ hexo server
</code></pre>
<p>More info: <a href="http://hexo.io/docs/server.html" target="_blank" rel="external">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><pre><code class="bash">$ hexo generate
</code></pre>
<p>More info: <a href="http://hexo.io/docs/generating.html" target="_blank" rel="external">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><pre><code class="bash">$ hexo deploy
</code></pre>
<p>More info: <a href="http://hexo.io/docs/deployment.html" target="_blank" rel="external">Deployment</a></p>
<h3 id="以上命令都可以简写"><a href="#以上命令都可以简写" class="headerlink" title="以上命令都可以简写"></a>以上命令都可以简写</h3><pre><code class="bash">$ hexo g
$ hexo s
$ hexo d
</code></pre>
<h3 id="遇到的问题"><a href="#遇到的问题" class="headerlink" title="遇到的问题"></a>遇到的问题</h3><p>_config.yml文件内容:</p>
<pre><code class="yaml"># Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
type: git
repository: [email protected]:<uesrname>/<uesrname>.github.io.git
branch: master
</code></pre>
<p>执行git deploy时,windows下没有问题,Mac下回报错:<br><em>ERROR Deployer not found: git</em><br>论坛里有说配置时候冒号后面要空格,(type: xxx),也有说<br>repository: [email protected]:<uesrname>/<uesrname>.github.io.git<br>修改为:<br>repository: <a href="https://github.com/" target="_blank" rel="external">https://github.com/</a><uesrname>/<uesrname>.github.io.git,<br>还有的说是版本问题:</uesrname></uesrname></uesrname></uesrname></p>
<h4 id="查看版本-(windows和Mac都是V-3-1)"><a href="#查看版本-(windows和Mac都是V-3-1)" class="headerlink" title="查看版本 (windows和Mac都是V_3.1)"></a>查看版本 (windows和Mac都是V_3.1)</h4><pre><code>hexo -v
##hexo: 3.1.1
</code></pre><p>最后在<a href="https://github.com/hexojs/hexo/issues/1154" target="_blank" rel="external">github的hexojs板块找到解决方案</a>:</p>
<pre><code class="bash">npm install hexo-deployer-git --save
</code></pre>
</div>
<div class="article-info article-info-index">
<div class="article-tag tagcloud">
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Git/">Git</a></li></ul>
</div>
<div class="article-category tagcloud">
<a class="article-category-link" href="/categories/TECH/">TECH</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</article>
<article id="post-ComposerInit" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2016/03/17/ComposerInit/" class="article-date">
<time datetime="2016-03-17T07:41:21.000Z" itemprop="datePublished">2016-03-17</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/03/17/ComposerInit/">Composer初始化</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h3 id="Composer"><a href="#Composer" class="headerlink" title="Composer"></a><a href="http://docs.phpcomposer.com/" target="_blank" rel="external">Composer</a></h3><ul>
<li>之前一直听说和使用compose,最近开始研究composer。Composer 类似于包管理器,但它在每个项目的基础上进行管理,在你项目的某个目录中(例如 vendor)进行安装。默认情况下它不会在全局安装任何东西。因此,这仅仅是一个依赖管理。</li>
</ul>
<h3 id="搭建Composer,以及遇到的问题"><a href="#搭建Composer,以及遇到的问题" class="headerlink" title="搭建Composer,以及遇到的问题"></a>搭建Composer,以及遇到的问题</h3><ul>
<li>环境 : Mac OS X EI Captian = 10.11.2 (15C50)</li>
<li>使用homebrew直接安装<pre><code class="bash">brew update
brew tap homebrew/php
brew tap homebrew/versions
brew install php56-intl
brew install homebrew/php/composer
</code></pre>
</li>
</ul>
<p>[之前按照文档走,brew tap josegonzalez/php,然后就会出现两个环境,</p>
<pre><code class="bash">Error: Formulae found in multiple taps:
</code></pre>
<p>最后brew untap josegonzalez/php,删除掉,然后在原来的环境里安装]</p>
<ul>
<li>新建项目文件夹 (composer/vendor)<pre><code class="bash">composer init //按照步骤一个个输入
composer install //这时候就已经在项目文件夹下安装好了
</code></pre>
</li>
</ul>
<h4 id="遇到的问题"><a href="#遇到的问题" class="headerlink" title="[遇到的问题]"></a>[遇到的问题]</h4><ul>
<li>[composer diagnose]</li>
<li>[Checking composer version: FAIL]执行 <pre><code class="bash">composer global self-update
curl -sS https://getcomposer.org/installer | php -- --check
composer dump-autoload
rm -rf /path/to/composer.lock /path/to/vendor/
</code></pre>
</li>
<li>[Checking composer.json: FAIL],composer validate<br>return:<pre><code class="bash">./composer.json is valid, but with a few warnings
See https://getcomposer.org/doc/04-schema.md for details on the schema
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
</code></pre>
在.composer.json中配置两个字段:<pre><code class="language">{
"name": "xxx/test_composer",
"description": "dev",
"authors": [
{
"name": "xxx",
"email": "[email protected]"
}
],
"minimum-stability": "alpha",
//这个字段解决The property description is required
"license": "proprietary",
"require": {}
}
</code></pre>
</li>
</ul>
<h5 id="遇到的问题基本都解决了,环境也搭建好了,接下来就能使用composer了。感谢作者Rob-耐心解答所有使用者的问题,收获良多。"><a href="#遇到的问题基本都解决了,环境也搭建好了,接下来就能使用composer了。感谢作者Rob-耐心解答所有使用者的问题,收获良多。" class="headerlink" title="遇到的问题基本都解决了,环境也搭建好了,接下来就能使用composer了。感谢作者Rob 耐心解答所有使用者的问题,收获良多。"></a>遇到的问题基本都解决了,环境也搭建好了,接下来就能使用composer了。感谢作者<a href="https://github.com/alcohol?tab=activity" target="_blank" rel="external">Rob</a> 耐心解答所有使用者的问题,收获良多。</h5>
</div>
<div class="article-info article-info-index">
<div class="article-tag tagcloud">
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Composer/">Composer</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/PHP/">PHP</a></li></ul>
</div>
<div class="article-category tagcloud">
<a class="article-category-link" href="/categories/TECH/">TECH</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</article>
<article id="post-Nginx-setting" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2016/03/17/Nginx-setting/" class="article-date">
<time datetime="2016-03-17T07:41:21.000Z" itemprop="datePublished">2016-03-17</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/03/17/Nginx-setting/">Nginx端口和伪静态</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h3 id="Nginx端口配置"><a href="#Nginx端口配置" class="headerlink" title="Nginx端口配置"></a>Nginx端口配置</h3><p>在学习composer写一个类似Laravel的框架,Laravel的强大之处就在于便捷的路由机制和方便的包引用。大的框架已经搭好,稍后附上git地址。</p>
<p>nginx路径:/usr/local/etc/nginx<br>配置文件:nginx.conf</p>
<pre><code class="linux">worker_processes 1;
error_log /usr/local/var/logs/nginx/error.log debug;
pid /usr/local/var/run/nginx.pid;
events {
worker_connections 256;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$http_x_forwarded_for" $host $request_time $upstream_response_time $scheme '
'$cookie_evalogin';
access_log /usr/local/var/logs/access.log main;
sendfile on;
keepalive_timeout 65;
port_in_redirect off;
include /usr/local/etc/nginx/sites-enabled/*;
}
</code></pre>
<p>在site-enabled里新建default.conf文件,</p>
<pre><code class="linux">server {
listen 81;
server_name localhost;
root /Users/xcy/Projects/www/pfc/public;
location / {
index index.html index.htm index.php;
include /usr/local/etc/nginx/conf.d/php-fpm;
}
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
}
}
</code></pre>
<h3 id="Nginx伪静态"><a href="#Nginx伪静态" class="headerlink" title="Nginx伪静态"></a>Nginx伪静态</h3><p>访问127.0.0.1:81没问题,但是再带上其他参数都报404,查询了下,说是nginx伪静态问题,需要rewrite<br>在site-enabled/default.conf新增一行 <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files" target="_blank" rel="external">try_files $uri $uri/ /index.php</a>;</p>
<pre><code class="linux">server {
listen 81;
server_name localhost;
root /Users/xcy/Projects/www/pfc/public;
location / {
index index.html index.htm index.php;
include /usr/local/etc/nginx/conf.d/php-fpm;
try_files $uri $uri/ /index.php;
}
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
}
}
</code></pre>
</div>
<div class="article-info article-info-index">
<div class="article-tag tagcloud">
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Composer/">Composer</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Nginx/">Nginx</a></li></ul>
</div>
<div class="article-category tagcloud">
<a class="article-category-link" href="/categories/TECH/">TECH</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</article>
<article id="post-PHP" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2016/03/17/PHP/" class="article-date">
<time datetime="2016-03-17T07:41:21.000Z" itemprop="datePublished">2016-03-17</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/03/17/PHP/">PHP相关</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h3 id="PHP文件的解释过程"><a href="#PHP文件的解释过程" class="headerlink" title="PHP文件的解释过程"></a>PHP文件的解释过程</h3><h5 id="前提:需要弄清楚cli-cgi-sapi的概念"><a href="#前提:需要弄清楚cli-cgi-sapi的概念" class="headerlink" title="前提:需要弄清楚cli, cgi, sapi的概念"></a>前提:<a href="http://php.net/manual/zh/features.commandline.php" target="_blank" rel="external">需要弄清楚cli, cgi, sapi的概念</a></h5><p>SAPI是Server Application Programming Interface(服务器应用编程接口)的缩写。PHP通过SAPI提供了一组接口,供Application和PHP内核之间进行数据交互。</p>
<p>在代码库里和命令行下分别查看sapi名称:</p>
<pre><code class="php">echo php_sapi_name(); //cgi-sapi
</code></pre>
<pre><code class="bash">php -r "echo php_sapi_name();" //sli-sapi
</code></pre>
<p>这就清楚了,应用在Web服务器中的就叫做CGI SAPI,应用在终端上的SAPI就叫做CLI SAPI。在windows下安装php你会看到两个exe:php.exe和php-cgi.exe这个就对应的是这两种SAPI。</p>
<p>终端查看PHP版本时,也会输出相关信息 <strong><em>5.6.12 (cli)</em></strong></p>
<pre><code class="bash">php -v //PHP 5.6.12 (cli) (built: Aug 8 2015 01:24:09) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
</code></pre>
</div>
<div class="article-info article-info-index">
<div class="article-tag tagcloud">
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/PHP/">PHP</a></li></ul>
</div>
<div class="article-category tagcloud">
<a class="article-category-link" href="/categories/TECH/">TECH</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</article>
<article id="post-PHP-FPM" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2016/03/17/PHP-FPM/" class="article-date">
<time datetime="2016-03-17T07:41:21.000Z" itemprop="datePublished">2016-03-17</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/03/17/PHP-FPM/">升级PHP,遇到的PHP-FPM问题</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h3 id="PHP-FPM遇到的问题"><a href="#PHP-FPM遇到的问题" class="headerlink" title="PHP-FPM遇到的问题"></a>PHP-FPM遇到的问题</h3><p>昨天安装了composer,今天打算试下,但是发现我</p>
<pre><code class="bash">php -v
PHP 5.5.3 (cli)
</code></pre>
<p>明明早就升级到5.6了。卸载了5.6,又安装了7.0,还是显示5.5。最后觉得应该是PATH,重新export了一遍PATH,source ~/.bash_profile,再尝试就ok了。</p>
<p>接下来以为一切ok,可以试用7.0了,结果<a href="http://127.0.0.1/居然是显示(PHP" target="_blank" rel="external">http://127.0.0.1/居然是显示(PHP</a> Version 5.6.13),homebrew已经卸载了5.6版本,重启了nginx也无济于事。</p>
<p>最后觉得应该是fpm需要重启下,不然不可能卸载了还在运行。</p>
<pre><code class="bash"># 先关闭之前的php-fpm
sudo killall php-fpm
# 启动PHP-fpm,但需要退出
/usr/local/Cellar/php70/7.0.1/sbin/php-fpm --fpm-config /usr/local/etc/php/7.0/php-fpm.conf
# 启动PHP-fpm
/usr/local/Cellar/php70/7.0.1/sbin/php70-fpm start
</code></pre>
<p>重新访问下localhost,版本对了。</p>
<h3 id="现在在想php-fpm的问题,难道我卸载了php,只要不重启fpm,服务器还是能正常访问?"><a href="#现在在想php-fpm的问题,难道我卸载了php,只要不重启fpm,服务器还是能正常访问?" class="headerlink" title="现在在想php-fpm的问题,难道我卸载了php,只要不重启fpm,服务器还是能正常访问?"></a>现在在想php-fpm的问题,难道我卸载了php,只要不重启fpm,服务器还是能正常访问?</h3>
</div>
<div class="article-info article-info-index">
<div class="article-tag tagcloud">
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/PHP/">PHP</a></li></ul>
</div>
<div class="article-category tagcloud">
<a class="article-category-link" href="/categories/TECH/">TECH</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</article>
<article id="post-Paf" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2016/03/17/Paf/" class="article-date">
<time datetime="2016-03-17T07:41:21.000Z" itemprop="datePublished">2016-03-17</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 itemprop="name">
<a class="article-title" href="/2016/03/17/Paf/">PHP个人框架PAF开发(1)</a>
</h1>
</header>
<div class="article-entry" itemprop="articleBody">
<h3 id="个人框架开发-PAF-PHP-Another-Framework"><a href="#个人框架开发-PAF-PHP-Another-Framework" class="headerlink" title="个人框架开发(PAF = PHP Another Framework)"></a>个人框架开发(PAF = PHP Another Framework)</h3><ul>
<li><h4 id="框架目录结构"><a href="#框架目录结构" class="headerlink" title="框架目录结构"></a>框架目录结构</h4><img src="http://7xo7qs.com1.z0.glb.clouddn.com/paf1.png?imageView2/1/w/200/h/300" alt=""></li>
</ul>
<h5 id="I-第一部分:基于VC的输入输出:"><a href="#I-第一部分:基于VC的输入输出:" class="headerlink" title="I.第一部分:基于VC的输入输出:"></a>I.第一部分:基于VC的输入输出:</h5><ul>
<li>配置文件 paf.conf<br>定义全局变量<br>```php<br>define(‘PAF_PATH’, ‘paf’);</li>
</ul>
<p>//配置模板版本<br>define(‘PAF_VIEW_PATH’, ‘default’);</p>
<p>define(‘PAF_VIEW_HEADER’, ‘header’);<br>define(‘PAF_VIEW_FOOTER’, ‘footer’);</p>