XAMP简明部署

题目起的有点大,其实是Windows平台,Linux大家直接用包好了啊…

这个组合主要是跑PHP FastCGI模式( 虽然在windows下面没啥用 ),资源紧张的用户还是走传统形式吧。

这个是我实际开发时的环境,主要是为了做个笔记免得自己忘记,Nginx 其实也配上了,不过Windows下面效率不高,因为没了.htaccess文件的支持,我在的项目里也用不上,再去用它实在是自找麻烦…

网上也有许多打包好的包,比如PUPW,Xampp等,不过别人的始终不是太适合自用,而且改配置什么也麻烦,所以还不如自己配置一个用用,省时省力。

PHP及其插件

Windows主要从http://windows.php.net/
PHP的一些插件存放在http://windows.php.net/downloads/pecl/
64bit的一些插件在
http://www.mediafire.com/php-win64-extensions (http://www.anindya.com/)
http://www.iis.net/downloads/microsoft/wincache-extension

PHP 5.2以后的版本中的 extras 文件夹不包含如 mibs 的文件,可以去xampp里面拿出来借用一下哈,当然也可以直接装Net-SNMP然后用其中的MIBS

php.ini配置

用于开发的配置,有些属于我这边特殊情况…参考下

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
;都是建议关闭的,但是开发人员层次不齐...
short_open_tag = On

;默认开发时用ALL,但是开发人员层次不齐...
error_reporting = E_ALL & ~E_NOTICE

; include路径
include_path = ".;d:\namp\php-nts\includes"

;插件路径
extension_dir = "ext"

; 动态加载模块,只在apache有用,生产上要关闭
enable_dl = On

;常用插件
extension=php_bz2.dll
extension=php_curl.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mysql.dll
extension=php_sockets.dll

;加载 memcached
[memcached]
extension=php_memcache.dll

;默认时区
date.timezone = "Asia/Shanghai"

; Extra Config Edit By Niphor

; Magic quotes
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off

; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Of

[mime_magic]
;mime_magic.magicfile = "d:\namp\php-nts\extras\magic.mime"
;mime_magic.debug = On

;======下面是一些插件的默认设置项======

;eAccelerator 配置

[eAccelerator]
;zend_extension = "d:\namp\php\ext\php_eaccelerator_nts.dll"

; The amount of shared memory (in megabytes) that eAccelerator will use.
; "0" means OS default. Default value is "0".
eaccelerator.shm_size = "0"

; The directory that is used for disk cache. eAccelerator stores precompiled
; code, session data, content and user entries  here. The same data can be
; stored in shared memory also (for more quick access). Default value is
; "/tmp/eaccelerator".
eaccelerator.cache_dir = "d:\namp\tmp"

; Enables or disables eAccelerator. Should be "1" for enabling or
; "0" for disabling. Default value is "1".
eaccelerator.enable = "1"

; Enables or disables debug logging. Setting this to 1 will print information
; to the log file about the cach hits of a file.
eaccelerator.debug = 0

; Set the log file for eaccelerator. When this option isn't set then the data
; will be logged to stderr
;eaccelerator.log_file = "d:\namp\apache\logs\eaccelerator.log"

; Enables or disables PHP file modification checking. Should be "1"
; for enabling or "0" for disabling. You should set it to "1" if you want
; to recompile PHP files after modification. Default value is "1".
eaccelerator.check_mtime = "1"

; Determine which PHP files must be cached. You may specify the number of
; patterns (for example "*.php *.phtml") which specifies to cache or
; not to cache. If pattern starts with the character "!", it means to ignore
; files which are matched by the following pattern. Default value is "" that
; means - all PHP scripts will be cached.
eaccelerator.filter = ""

; Disables putting large values into shared memory by "eaccelerator_put()"
; function.
; It indicates the largest allowed size in bytes (10240, 10K, 1M). The "0"
; disables the limit. Default value is "0".
eaccelerator.shm_max = "0"

; When eAccelerator fails to get shared memory for new script it removes
; all scripts which were not accessed at last "shm_ttl" seconds from shared
; memory. Default value is "0" that means - don't remove any files from
; shared memory.
eaccelerator.shm_ttl = "0"

; When eAccelerator fails to get shared memory for new script it tryes to
; remove old script if the previous try was made more then "shm_prune_period"
; seconds ago. Default value is "0" that means - don't try to remove any
; files from shared memory.
eaccelerator.shm_prune_period = "0"

; Enables or disables caching of compiled scripts on disk. It has no effect
; on session data and content caching.
; Default value is "0" that means - use disk and shared memory for caching.
eaccelerator.shm_only = "0"

;XDebug 配置
[XDebug]
zend_extension = "d:\namp\php-nts\ext\php_xdebug-2.2.2-5.4-vc9-nts.dll"

; xdebug.auto_trace
; Type: boolean, Default value: 0
; When this setting is set to on, the tracing of function calls will be enabled just before the
; script is run. This makes it possible to trace code in the auto_prepend_file.
;xdebug.auto_trace = 0

; xdebug.collect_includes
; Type: boolean, Default value: 1
; This setting, defaulting to On, controls whether Xdebug should write the filename used in include
; (), include_once(), require() or require_once() to the trace files.
;xdebug.collect_includes = 1

; xdebug.collect_params
; Type: integer, Default value: 0
;
; This setting, defaulting to 0, controls whether Xdebug should collect the parameters passed to
; functions when a function call is recorded in either the function trace or the stack trace.
;xdebug.collect_params = 0

; xdebug.collect_return
; Type: boolean, Default value: 0
; This setting, defaulting to Off, controls whether Xdebug should write the return value of function
; calls to the trace files.
;xdebug.collect_return = 0

; xdebug.collect_vars
; Type: boolean, Default value: Off
; This setting tells Xdebug to gather information about which variables are used in a certain scope.
; This analysis can be quite slow as Xdebug has to reverse engineer PHP's opcode arrays. This setting
; will not record which values the different variables have, for that use xdebug.collect_params. This
; setting needs to be enabled only if you wish to use xdebug_get_declared_vars().
;xdebug.collect_vars = "Off"

; xdebug.default_enable
; Type: boolean, Default value: On
; If this setting is On then stacktraces will be shown by default on an error event. You can disable
; showing stacktraces from your code with xdebug_disable(). As this is one of the basic functions of
; Xdebug, it is advisable to leave this setting set to 'On'.
;xdebug.default_enable = "On"

; xdebug.dump.*
; Type: string, Default value: Empty
; * = COOKIE, FILES, GET, POST, REQUEST, SERVER, SESSION. These seven settings control which data
; from the superglobals is shown when an error situation occurs. Each php.ini setting can consist of
; a comma seperated list of variables from this superglobal to dump, but make sure you do not add
; spaces in this setting. In order to dump the REMOTE_ADDR and the REQUEST_METHOD when an error
; occurs, add this setting:
;
; xdebug.dump.SERVER = REMOTE_ADDR,REQUEST_METHOD
; xdebug.dump.SERVER = REMOTE_ADDR,REQUEST_METHOD
;xdebug.dump.COOKIE = ""
;xdebug.dump.FILES = ""
;xdebug.dump.GET = ""
;xdebug.dump.POST = ""
;xdebug.dump.REQUEST = ""
;xdebug.dump.SERVER = ""
;xdebug.dump.SESSION = ""

; xdebug.dump_globals
; Type: boolean, Default value: 1
; Controls whether the values of the superglobals as defined by the xdebug.dump.* settings whould be
; shown or not.
;xdebug.dump_globals = 1

; xdebug.dump_once
; Type: boolean, Default value: 1
; Controls whether the values of the superglobals should be dumped on all error situations (set to
; Off) or only on the first (set to On).
;xdebug.dump_once = 1

; xdebug.dump_undefined
; Type: boolean, Default value: 0
; If you want to dump undefined values from the superglobals you should set this setting to On,
; otherwise leave it set to Off.
;xdebug.dump_undefined = 0

; xdebug.extended_info
; Type: integer, Default value: 1
; Controls whether Xdebug should enforce 'extended_info' mode for the PHP parser; this allows Xdebug
; to do file/line breakpoints with the remote debugger. When tracing or profiling scripts you
; generally want to turn off this option as PHP's generated oparrays will increase with about a third
; of the size slowing down your scripts. This setting can not be set in your scripts with ini_set(),
; but only in php.ini.
;xdebug.extended_info = 1

; xdebug.file_link_format
; Type: string, Default value: *empty string* , Introduced in Xdebug 2.1
;
; This setting determines the format of the links that are made in the display of stack traces where
; file names are used. This allows IDEs to set up a link-protocol that makes it possible to go
; directly to a line and file by clicking on the filenames that Xdebug shows in stack traces.
;xdebug.file_link_format = ""

; xdebug.idekey
; Type: string, Default value: *complex*
; Controls which IDE Key Xdebug should pass on to the DBGp debugger handler. The default is based on
; environment settings. First the environment setting DBGP_IDEKEY is consulted, then USER and as last
; USERNAME. The default is set to the first environment variable that is found. If none could be
; found the setting has as default ''.
;xdebug.idekey = ""

; xdebug.manual_url
; Type: string, Default value: http://www.php.net
; This is the base url for the links from the function traces and error message to the manual pages
; of the function from the message. It is advisable to set this setting to use the closest mirror.
;xdebug.manual_url = "http://www.php.net"

; xdebug.max_nesting_level
; Type: integer, Default value: 100
; Controls the protection mechanism for infinite recursion protection. The value of this setting is
; the maximum level of nested functions that are allowed before the script will be aborted.
;xdebug.max_nesting_level = 100

; xdebug.overload_var_dump
; Type: boolean, Default value: 1 , Introduced in Xdebug 2.1
; By default Xdebug overloads var_dump() with its own improved version for displaying variables when
; the html_errors php.ini setting is set to 1. In case you do not want that, you can set this setting
; to 0, but check first if it's not smarter to turn off html_errors.
;xdebug.overload_var_dump = 1

; xdebug.profiler_append
; Type: integer, Default value: 0
; When this setting is set to 1, profiler files will not be overwritten when a new request would map
; to the same file (depnding on the xdebug.profiler_output_name setting. Instead the file will be
; appended to with the new profile.
xdebug.profiler_append = 0

; xdebug.profiler_enable
; Type: integer, Default value: 0
; Enables Xdebug's profiler which creates files in the profile output directory. Those files can be
; read by KCacheGrind to visualize your data. This setting can not be set in your script with ini_set
; ().
xdebug.profiler_enable = 0

; xdebug.profiler_enable_trigger
; Type: integer, Default value: 0
; When this setting is set to 1, you can trigger the generation of profiler files by using the
; XDEBUG_PROFILE GET/POST parameter. This will then write the profiler data to defined directory.
xdebug.profiler_enable_trigger = 0

; xdebug.profiler_output_dir
; Type: string, Default value: /tmp
; The directory where the profiler output will be written to, make sure that the user who the PHP
; will be running as has write permissions to that directory. This setting can not be set in your
; script with ini_set().
xdebug.profiler_output_dir = "d:\namp\tmp"

; xdebug.profiler_output_name
; Type: string, Default value: cachegrind.out.%p
;
; This setting determines the name of the file that is used to dump traces into. The setting
; specifies the format with format specifiers, very similar to sprintf() and strftime(). There are
; several format specifiers that can be used to format the file name.
;
; See the xdebug.trace_output_name documentation for the supported specifiers.
xdebug.profiler_output_name = "xdebug_profile.%R::%u"

; xdebug.remote_autostart
; Type: boolean, Default value: 0
; Normally you need to use a specific HTTP GET/POST variable to start remote debugging (see Remote
; Debugging). When this setting is set to 'On' Xdebug will always attempt to start a remote debugging
; session and try to connect to a client, even if the GET/POST/COOKIE variable was not present.
;xdebug.remote_autostart = 0

; xdebug.remote_enable
; Type: boolean, Default value: 0
; This switch controls whether Xdebug should try to contact a debug client which is listening on the
; host and port as set with the settings xdebug.remote_host and xdebug.remote_port. If a connection
; can not be established the script will just continue as if this setting was Off.
;xdebug.remote_enable = 0

; xdebug.remote_handler
; Type: string, Default value: dbgp
; Can be either 'php3' which selects the old PHP 3 style debugger output, 'gdb' which enables the GDB
; like debugger interface or 'dbgp' - the brand new debugger protocol. The DBGp protocol is more
; widely supported by clients. See more information in the introduction for Remote Debugging.
;xdebug.remote_handler = "dbgp"

; xdebug.remote_host
; Type: string, Default value: localhost
; Selects the host where the debug client is running, you can either use a host name or an IP
; address.
;xdebug.remote_host = "localhost"

; xdebug.remote_log
; Type: string, Default value: none
; If set to a value, it is used as filename to a file to which all remote debugger communications are
; logged. The file is always opened in append-mode, and will therefore not be overwritten by default.
; There is no concurrency protection available.
;xdebug.remote_log = "none"

; xdebug.remote_mode
; Type: string, Default value: req
;
; Selects when a debug connection is initiated. This setting can have two different values:
;
; req
;     Xdebug will try to connect to the debug client as soon as the script starts.
; jit
;     Xdebug will only try to connect to the debug client as soon as an error condition occurs.
;xdebug.remote_mode = "req"

; xdebug.remote_port
; Type: integer, Default value: 9000
; The port to which Xdebug tries to connect on the remote host. Port 9000 is the default for both the
; client and the bundled debugclient. As many clients use this port number, it is best to leave this
; setting unchanged.
;xdebug.remote_port = 9000

; xdebug.show_exception_trace
; Type: integer, Default value: 0
; When this setting is set to 1, Xdebug will show a stack trace whenever an exception is raised -
; even if this exception is actually caught.
;xdebug.show_exception_trace = 0

; xdebug.show_local_vars
; Type: integer, Default value: 0
; When this setting is set to something != 0 Xdebug's generated stack dumps in error situations will
; also show all variables in the top-most scope. Beware that this might generate a lot of
; information, and is therefore turned off by default.
;xdebug.show_local_vars = 0

; xdebug.show_mem_delta
; Type: integer, Default value: 0
; When this setting is set to something != 0 Xdebug's human-readable generated trace files will show
; the difference in memory usage between function calls. If Xdebug is configured to generate
; computer-readable trace files then they will always show this information.
;xdebug.show_mem_delta = 0

; xdebug.trace_format
; Type: integer, Default value: 0
; The format of the trace file.
;
; See the introduction of Function Traces for a few examples.
;xdebug.trace_format = 0

; xdebug.trace_options
; Type: integer, Default value: 0
; When set to '1' the trace files will be appended to, instead of being overwritten in subsequent
; requests.
;xdebug.trace_options = 0

; xdebug.trace_output_dir
; Type: string, Default value: /tmp
; The directory where the tracing files will be written to, make sure that the user who the PHP will
; be running as has write permissions to that directory.
; xdebug.trace_output_name
xdebug.trace_output_dir = "d:\namp\tmp"

; Type: string, Default value: trace.%c
;
; This setting determines the name of the file that is used to dump traces into. The setting
; specifies the format with format specifiers, very similar to sprintf() and strftime(). There are
; several format specifiers that can be used to format the file name. The '.xt' extension is always
; added automatically.
;xdebug.trace_output_name = "trace.%c"

; xdebug.var_display_max_children
; Type: integer, Default value: 128
; Controls the amount of array children and object's properties are shown when variables are
; displayed with either xdebug_var_dump(), xdebug.show_local_vars or through Function Traces. This
; setting does not have any influence on the number of children that is send to the client through
; the Remote Debugging feature.
;xdebug.var_display_max_children = 128

; xdebug.var_display_max_data
; Type: integer, Default value: 512
; Controls the maximum string length that is shown when variables are displayed with either
; xdebug_var_dump(), xdebug.show_local_vars or through Function Traces. This setting does not have
; any influence on the amount of data that is send to the client through the Remote Debugging
; feature.
;xdebug.var_display_max_data = 512

; xdebug.var_display_max_depth
; Type: integer, Default value: 3
; Controls how many nested levels of array elements and object properties are when variables are
; displayed with either xdebug_var_dump(), xdebug.show_local_vars or through Function Traces. This
; setting does not have any influence on the depth of children that is send to the client through the
; Remote Debugging feature.
;xdebug.var_display_max_depth = 3

Apache及其插件

Windos平台主要的更新站点是:http://www.apachelounge.com
最新版本更新贴是:http://www.apachelounge.com/viewtopic.php?p=24281
文档还在官网:http://httpd.apache.org/docs/2.4/

vs11编译的版本不能在XP上使用,XP请选择VS10编译的版本

httpd.conf配置

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
# 服务器信息
ServerRoot "D:/namp/apache"
ServerAdmin niphor@gmail.com
ServerName localhost

# 使用rewrite
LoadModule rewrite_module modules/mod_rewrite.so

#网站根目录权限设置
DocumentRoot "D:/namp/htdocs"
<Directory "D:/namp/htdocs">
    Options Indexes FollowSymLinks ExecCGI
    AllowOverride ALL
    Require all granted
    Order allow,deny
    Allow from all
</Directory>

# 默认页面设置
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

#htaccess文件权限
<Files ".ht*">
    Require all granted
</Files>

# 配置别名
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "D:/namp/cgi-bin/"
</IfModule>

#添加处理句柄
AddHandler cgi-script .cgi .pl
<Directory "D:/namp/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
    SetHandler cgi-script
</Directory>

#导入自定义配置
Include conf/niphor.conf
Include conf/niphor-vhosts.conf

#Fast-CGI模式设置
LoadModule fcgid_module modules/mod_fcgid.so
<IfModule mod_fcgid.c>
	# Define the MIME-Type for ".php" files
	AddType application/x-httpd-php .php
	AddHandler fcgid-script .cgi .fcgi .php
	
	# Where to look for the php.ini file?
	FcgidInitialEnv PHPRC "D:/namp/php"
	# Set PHP_FCGI_MAX_REQUESTS to greater than or equal to FcgidMaxRequestsPerProcess
	# to prevent php-cgi process from exiting before all requests completed
	FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
	# Maximum requests a process should handle before it is terminated
	FcgidMaxRequestsPerProcess 1000
	# Maximum number of PHP processes
	FcgidMaxProcesses 15
	# Number of seconds of idle time before a php-cgi process is terminated
	FcgidIOTimeout 120
	FcgidIdleTimeout 120
	#Path to php-cgi
	FcgidMaxRequestLen 1310720
	FcgidWrapper "D:/namp/php-nts/php-cgi.exe" .php
	ScriptAlias /fcgi-bin/ "D:/namp/fcgi-bin/"

<Files ~ "\.php$>"
   SetHandler fcgid-script
   FcgidWrapper "D:/namp/php-nts/php-cgi.exe" .php
</Files>

</IfModule>

<Directory "d:/namp/fcgi-bin">
    AllowOverride None
    Options None
    Require all granted
    SetHandler fcgid-script
</Directory>

#GZip 设置
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
<IfModule mod_deflate.c>
	#必须的,就像一个开关一样,告诉apache对传输到浏览器的内容进行压缩
    SetOutputFilter DEFLATE
	
	#设置不对后缀gif,jpg,jpeg,png的图片文件进行压缩
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
	
	#同上,就是设置不对exe,tgz,gz。。。的文件进行压缩
    SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary 
    SetEnvIfNoCase Request_URI .(?:pdf|mov|avi|mp3|mp4|rm)$ no-gzip dont-vary
	
	#设置对文件是文本的内容进行压缩,例如text/html  text/css  text/plain等
    AddOutputFilterByType DEFLATE text/* 
	
	#这段代码你只需要了解application/javascript application/x-javascript这段就可以了,这段的意思是对javascript文件进行压缩
    AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript application/javascript application/x-javascript
	
	#这段是告诉apache对php类型的文件进行压缩
    AddOutputFilterByType DEFLATE application/x-httpd-php application/x-httpd-fastphp
	
	# Netscape 4.x 有一些问题,所以只压缩文件类型是text/html的
    BrowserMatch ^Mozilla/4 gzip-only-text/html 
	
	# Netscape 4.06-4.08 有更多的问题,所以不开启压缩
    BrowserMatch ^Mozilla/4.0[678] no-gzip
	
	# IE浏览器会伪装成 Netscape ,但是事实上它没有问题
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
</IfModule>

#最大在线人数,根据你需要的人数和你服务器机器的配置来确定
MaxKeepAliveRequests 100

#语言优先级,把中文(zh-CN zh-TW)的部分剪切放到前面(也就是将原来文件中的相应部分改成如上的)
LanguagePriority zh-CN zh-TW en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv


#VHost配置
Listen 81
<VirtualHost *:81>
    ServerAdmin niphor@gmail.com
    ServerName  dev.kern.com
    DocumentRoot "D:/namp/htdocs/user/"
</VirtualHost>

PHP的挂载

还是在httpd.conf中搜索LoadModule找到相关章节 ,在后面添加如下内容

1
2
3
4
#注意:其中X:PHP/PHP5Apache2.dll 中的X:/PHP/是你安装PHP的路径
LoadModule php5_module "X:/PHP/php5Apache2.dll"
AddType application/x-httpd-php .php
AddDefaultCharset ISO-8859-1

MariaDB

因为Mysql越来越闭源了(http://dev.mysql.com/downloads/mysql/),所以我装了个MariaDB,其实是装B而已…

官网https://downloads.mariadb.org/
数据库的使用还是要看实际的业务,默认我直接用的small的配置,实际有需求再改就行了

memecache

下载地址
http://downloads.northscale.com/
http://blog.elijaa.org/index.php?post/2010/10/15/Memcached-for-Windows

多余文件的删除

默认情况下,下载的zip包包含了N多开发用的工具,如果不是开发需要,可以删除
删除后大概能节约一半的空间,效果客观= =!

apache

1
2
3
4
include文件夹
lib文件夹下的 *.lib库
logs文件夹,自己定义到统一的地方方便管理
manual文件夹,手册可以直接看在线的

MariaDB/MySQL

1
2
3
4
5
6
7
bin 下面的*.pdb调试符号
doc文件夹
include 文件夹
lib 下面的*.pdb调试符号
mysql-test文件夹,不是跑负载测试,可以删了
sql-bench文件夹,不是跑负载测试,可以删了
support-files

服务注册/卸载批处理

这边直接用的%~dp0,所以要在当前文件夹运行哦,不然路径会有问题

Apache

1
2
3
4
5
6
7
8
9
10
11
12
13
#注册
@echo off 
echo start Apache on localhost 
%~dp0apache\bin\httpd.exe -k install -n namp_apache -d %~dp0apache
net start namp_apache
pause

#卸载
@echo off 
echo stop Apache
net stop namp_apache
%~dp0apache\bin\httpd.exe -k uninstall -n namp_apache
pause

MariaDB

1
2
3
4
5
6
7
8
9
10
11
12
13
#注册
@echo off 
echo start MariaDB on localhost 
%~dp0mariadb\bin\mysqld  --install namp_mariadb --defaults-file=%~dp0mariadb\my.ini
net start namp_mariadb
pause

#卸载
@echo off 
echo stop MariaDB
net stop namp_mariadb
%~dp0mariadb\bin\mysqld.exe --remove namp_mariadb
pause

Memcached

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#注册
@echo off 
echo start Memcached on localhost

#这里注释掉了官方注册服务的方法,因为官方注册的服务不会带参数,还得自己改
#而且官方的服务是不能定服务名的
rem %~dp0memcached\memcached.exe -p 11211 -c 1000 -m 128 -d install namp_memcached
rem sc config memcached binpath= "\"%~dp0memcached\memcached.exe\" -p 11211 -c 1000 -m 128 -d 
runservice" DisplayName= namp_memcached

sc create namp_memcached binpath= "\"%~dp0memcached\memcached.exe\" -p 11211 -c 1000 -m 128 -d runservice" start= auto
net start "namp_memcached" 
pause 

#卸载
@echo off 
echo stop Memcached on localhost 
net stop "namp_memcached"

# 官方卸载的方法,因为自己建的服务,不能用官方方法卸载,只能自己删除,所以这里注释掉了。
rem %~dp0memcached\memcached.exe -d uninstall "memcached"
sc delete "namp_memcached"
pause

[TOC]