专注业务连续性支持与数据保护
标签类目:php
2010-04-04技术合集

mac os x配置apache和php已关闭评论

mac os x配置apache和php

本文采用的方式是使用Mac OS X 10.5.8自带的Apache和PHP,安装MySQL的dmg版本,以下操作非特殊说明均以root用户在命令行下进行。

启用root用户
1.打开“目录实用工具”,它位于“应用程序”文件夹的“实用工具”文件夹中。
2.点按锁图标以进行更改。您将需要输入管理员名称和密码。
3.选取“编辑”>“启用 Root 用户”。
4.为 root 用户输入安全密码,然后在“验证”栏再次输入它,最后点按“好”。

启用Apache
Mac OS X 10.5.8自带了Apache 2.2.9,直接在命令行运行apachectl start,Apache就搞定了。

现在Apache的主目录就是/Libary/WebServer/Documents/,你可以在这目录里放置文件测试了。
继续阅读 »

2010-01-25技术合集

php读取mac地址已关闭评论

php读取mac地址

1. 
2.
3. class GetMacAddress {
4. var $return_array = array();
5. var $mac_addr;
6.
7. function _construct($os_type) {
8. switch (strtolower($os_type)) {
9. case "linux":
10. $this->forLinux();
11. break;
12. default:
13. $this->forWindows();
14. break;
15. }
16.
17. $temp_array = array();
18. foreach ($this->return_array as $value) {
19. if (preg_match(/[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f][:-]20. .[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f][:-].[0-9a-f][0-9a-f]/i”, $value, $temp_array)) {
21. $this->mac_addr = $temp_array[0];
22. break;
23. }
24. }
25.
26. unset($temp_array);
27. return $this->mac_addr;
28. }
29.
30. function forWindows() {
31. @exec(”ipconfig /all”, $this->return_array);
32.
33. if ($this->return_array) {
34. return $this->return_array;
35. } else {
36. $ipconfig = $_SERVER["SystemRoot"].”\system32\ipconfig.exe”;
37. if (is_file($ipconfig)) {
38. @exec($ipconfig./all”, $this->return_array);
39. } else {
40. @exec($_SERVER["WINDIR"].”\system\ipconfig.exe /all”, $this->return_array);
41. }
42. return $this->return_array;
43. }
44. }
45.
46. function forLinux() {
47. @exec(”ifconfig -a”, $this->return_array);
48. return $this->return_array;
49. }
50. }
51.
52. $mac = new GetMacAddress(null);
53. echo $mac->mac_addr;
54.
55. ?>