UGG Bailey Button UGG Classic Cardy Boots ghd ghd x卧底软件 DNF外挂 虫虫博客2009 注册上海公司 x卧底 六合
?> 鍧氭寔鍘熷垱锝 web寮鍙戞妧鏈丼EO銆佺敓娲诲皬璁般佹梾娓哥瓑淇℃伅鐨勫崥瀹: web钃濊崏鍗氬–LanCao’s Web Blog

鍧氭寔鍘熷垱锝 web寮鍙戞妧鏈丼EO銆佺敓娲诲皬璁般佹梾娓哥瓑淇℃伅鐨勫崥瀹

1)鐜锛

a. 鎴戜滑鏈湴鏄疻indows绯荤粺锛岀劧鍚庝娇鐢╒irutalBox瀹夎涓涓櫄鎷熺殑Linux绯荤粺銆
鍦ㄦ湰鍦扮殑Windows绯荤粺涓婂垎鍒畨瑁卬ginx(渚﹀惉8080绔彛)鍜宎pache(渚﹀惉80绔彛)銆傚湪铏氭嫙鐨凩inux绯荤粺涓婂畨瑁卆pache(渚﹀惉80绔彛)銆
杩欐牱鎴戜滑鐩稿綋浜庢嫢鏈変簡1鍙皀ginx鍦ㄥ墠绔綔涓哄弽鍚戜唬鐞嗘湇鍔″櫒锛涘悗闈㈡湁2鍙癮pache浣滀负搴旂敤绋嬪簭鏈嶅姟鍣(鍙互鐪嬩綔鏄皬鍨嬬殑server cluster銆;-) )锛

b. nginx鐢ㄦ潵浣滀负鍙嶅悜浠g悊鏈嶅姟鍣紝鏀剧疆鍒颁袱鍙癮pache涔嬪墠锛屼綔涓虹敤鎴疯闂殑鍏ュ彛锛
nginx浠呬粎澶勭悊闈欐侀〉闈紝鍔ㄦ佺殑椤甸潰(php璇锋眰)缁熺粺閮戒氦浠樼粰鍚庡彴鐨勪袱鍙癮pache鏉ュ鐞嗐
涔熷氨鏄锛屽彲浠ユ妸鎴戜滑缃戠珯鐨勯潤鎬侀〉闈㈡垨鑰呮枃浠舵斁缃埌nginx鐨勭洰褰曚笅锛涘姩鎬佺殑椤甸潰鍜屾暟鎹簱璁块棶閮戒繚鐣欏埌鍚庡彴鐨刟pache鏈嶅姟鍣ㄤ笂銆

c. 濡備笅浠嬬粛涓ょ鏂规硶瀹炵幇server cluster鐨勮礋杞藉潎琛°偮
鎴戜滑鍋囪鍓嶇nginx(涓127.0.0.1:80)浠呬粎鍖呭惈涓涓潤鎬侀〉闈ndex.html锛
鍚庡彴鐨勪袱涓猘pache鏈嶅姟鍣(鍒嗗埆涓簂ocalhost:80鍜158.37.70.143:80)锛屼竴鍙版牴鐩綍鏀剧疆phpMyAdmin鏂囦欢澶瑰拰test.php(閲岄潰娴嬭瘯浠g爜涓簆rint “server1″;)锛屽彟涓鍙版牴鐩綍浠呬粎鏀剧疆涓涓猼est.php(閲岄潰娴嬭瘯浠g爜涓簆rint “server2″;)銆

2)閽堝涓嶅悓璇锋眰聽鐨勮礋杞藉潎琛★細

a. 鍦ㄦ渶绠鍗曞湴鏋勫缓鍙嶅悜浠g悊鐨勬椂鍊聽(nginx浠呬粎澶勭悊闈欐佷笉澶勭悊鍔ㄦ佸唴瀹癸紝鍔ㄦ佸唴瀹逛氦缁欏悗鍙扮殑apache server鏉ュ鐞)锛屾垜浠叿浣撶殑璁剧疆涓猴細鍦╪ginx.conf涓慨鏀癸細
location ~ \.php$ {
聽聽聽 proxy_pass聽聽聽158.37.70.143:80聽;
}
>杩欐牱褰撳鎴风璁块棶localhost:8080/index.html鐨勬椂鍊欙紝鍓嶇鐨刵ginx浼氳嚜鍔ㄨ繘琛屽搷搴旓紱
>褰撶敤鎴疯闂甽ocalhost:8080/test.php鐨勬椂鍊(杩欎釜鏃跺檔ginx鐩綍涓嬫牴鏈氨娌℃湁璇ユ枃浠)锛屼絾鏄氳繃涓婇潰鐨勮缃甽ocation ~ \.php$(琛ㄧず姝e垯琛ㄨ揪寮忓尮閰嶄互.php缁撳熬鐨勬枃浠讹紝璇︽儏鍙傜湅location鏄浣曞畾涔夊拰鍖归厤鐨http://wiki.nginx.org/NginxHttpCoreModule)聽锛宯ginx鏈嶅姟鍣ㄤ細鑷姩pass缁158.37.70.143鐨刟pache鏈嶅姟鍣ㄤ簡銆傝鏈嶅姟鍣ㄤ笅鐨則est.php灏变細琚嚜鍔ㄨВ鏋愶紝鐒跺悗灏唄tml鐨勭粨鏋滈〉闈㈣繑鍥炵粰nginx锛岀劧鍚巒ginx杩涜鏄剧ず(濡傛灉nginx浣跨敤memcached妯″潡鎴栬卻quid杩樺彲浠ユ敮鎸佺紦瀛)锛岃緭鍑虹粨鏋滀负鎵撳嵃server2銆
濡備笂鏄渶涓虹畝鍗曠殑浣跨敤nginx鍋氫负鍙嶅悜浠g悊鏈嶅姟鍣ㄧ殑渚嬪瓙锛

b. 鎴戜滑鐜板湪瀵瑰涓婁緥瀛愯繘琛屾墿灞曪紝浣垮叾鏀寔濡備笂鐨勪袱鍙版湇鍔″櫒銆
鎴戜滑璁剧疆nginx.conf鐨剆erver妯″潡閮ㄥ垎锛屽皢瀵瑰簲閮ㄥ垎淇敼涓猴細
location ^~ /phpMyAdmin/ {
聽聽聽 proxy_pass聽聽聽127.0.0.1:80聽;
}
location ~ \.php$ {
聽聽聽 proxy_pass聽聽聽158.37.70.143:80聽;
}
涓婇潰绗竴涓儴鍒唋ocation ^~ /phpMyAdmin/锛岃〃绀轰笉浣跨敤姝e垯琛ㄨ揪寮忓尮閰(^~)锛岃屾槸鐩存帴鍖归厤锛屼篃灏辨槸濡傛灉瀹㈡埛绔闂殑URL鏄互http://localhost:8080/phpMyAdmin/聽寮澶寸殑璇(鏈湴鐨刵ginx鐩綍涓嬫牴鏈病鏈塸hpMyAdmin鐩綍)锛宯ginx浼氳嚜鍔╬ass鍒127.0.0.1:80聽鐨凙pache鏈嶅姟鍣紝璇ユ湇鍔″櫒瀵筽hpMyAdmin鐩綍涓嬬殑椤甸潰杩涜瑙f瀽锛岀劧鍚庡皢缁撴灉鍙戦佺粰nginx锛屽悗鑰呮樉绀猴紱
濡傛灉瀹㈡埛绔闂甎RL鏄http://localhost/test.php聽鐨勮瘽锛屽垯浼氳pass鍒158.37.70.143:80聽鐨刟pache杩涜澶勭悊銆

鍥犳缁间笂锛屾垜浠疄鐜颁簡閽堝涓嶅悓璇锋眰鐨勮礋杞藉潎琛°
>濡傛灉鐢ㄦ埛璁块棶闈欐侀〉闈ndex.html锛屾渶鍓嶇鐨刵ginx鐩存帴杩涜鍝嶅簲锛
>濡傛灉鐢ㄦ埛璁块棶test.php椤甸潰鐨勮瘽锛158.37.70.143:80聽鐨凙pache杩涜鍝嶅簲锛
>濡傛灉鐢ㄦ埛璁块棶鐩綍phpMyAdmin涓嬬殑椤甸潰鐨勮瘽锛127.0.0.1:80聽鐨凙pache杩涜鍝嶅簲锛

3)璁块棶鍚屼竴椤甸潰聽鐨勮礋杞藉潎琛★細
鐢ㄦ埛璁块棶http://localhost:8080/test.php聽杩欎釜鍚屼竴椤甸潰鐨勬椂鍊欙紝鎴戜滑瀹炵幇涓ゅ彴鏈嶅姟鍣ㄧ殑璐熻浇鍧囪 聽(瀹為檯鎯呭喌涓紝杩欎袱涓湇鍔″櫒涓婄殑鏁版嵁瑕佹眰鍚屾涓鑷达紝杩欓噷鎴戜滑鍒嗗埆瀹氫箟浜嗘墦鍗皊erver1鍜宻erver2鏄负浜嗚繘琛岃鲸璁ゅ尯鍒)銆

a. 鐜板湪鎴戜滑鐨勬儏鍐垫槸鍦╳indows涓媙ginx鏄痩ocalhost渚﹀惉8080绔彛锛
涓ゅ彴apache锛屼竴鍙版槸127.0.0.1:80(鍖呭惈test.php椤甸潰浣嗘槸鎵撳嵃server1)锛屽彟涓鍙版槸铏氭嫙鏈虹殑158.37.70.143:80(鍖呭惈test.php椤甸潰浣嗘槸鎵撳嵃server2)銆

b. 鍥犳閲嶆柊閰嶇疆nginx.conf涓猴細
>棣栧厛鍦╪ginx鐨勯厤缃枃浠秐ginx.conf鐨刪ttp妯″潡涓坊鍔狅紝鏈嶅姟鍣ㄩ泦缇erver cluster(鎴戜滑杩欓噷鏄袱鍙)鐨勫畾涔夛細
upstream myCluster {
聽聽聽 server聽127.0.0.1:80聽;
聽聽聽 server聽158.37.70.143:80聽;
}
琛ㄧず杩欎釜server cluster鍖呭惈2鍙版湇鍔″櫒
>鐒跺悗鍦╯erver妯″潡涓畾涔夛紝璐熻浇鍧囪 锛
location ~ \.php$ {
聽聽聽 proxy_pass聽聽http://myCluster聽; #杩欓噷鐨勫悕瀛楀拰涓婇潰鐨刢luster鐨勫悕瀛楃浉鍚
聽聽聽 proxy_redirect聽聽聽聽 off;
聽聽聽 proxy_set_header聽聽 Host聽聽聽聽聽聽聽聽聽聽聽聽 $host;
聽聽聽 proxy_set_header聽聽 X-Real-IP聽聽聽聽聽聽聽 $remote_addr;
聽聽聽 proxy_set_header聽聽 X-Forwarded-For聽 $proxy_add_x_forwarded_for;
}
杩欐牱鐨勮瘽锛屽鏋滆闂http://localhost:8080/test.php聽椤甸潰鐨勮瘽锛宯ginx鐩綍涓嬫牴鏈病鏈夎鏂囦欢锛屼絾鏄畠浼氳嚜鍔ㄥ皢鍏秔ass鍒癿yCluster瀹氫箟鐨勬湇鍔″尯鏈虹兢涓紝鍒嗗埆鐢127.0.0.1:80;鎴栬158.37.70.143:80;鏉ュ仛澶勭悊銆
涓婇潰鍦ㄥ畾涔塽pstream鐨勬椂鍊欐瘡涓猻erver涔嬪悗娌℃湁瀹氫箟鏉冮噸锛岃〃绀轰袱鑰呭潎琛★紱濡傛灉甯屾湜鏌愪釜鏇村鍝嶅簲鐨勮瘽渚嬪锛
upstream myCluster {
聽聽聽 server聽127.0.0.1:80聽weight=5;
聽聽聽 server聽158.37.70.143:80聽;
}
杩欐牱琛ㄧず5/6鐨勫嚑鐜囪闂涓涓猻erver,1/6璁块棶绗簩涓傚彟澶栬繕鍙互瀹氫箟max_fails鍜宖ail_timeout绛夊弬鏁般
http://wiki.nginx.org/NginxHttpUpstreamModule

====================

缁间笂锛屾垜浠浣跨敤nginx鐨勫弽鍚戜唬鐞嗘湇鍔″櫒reverse proxy server鐨勫姛鑳斤紝灏嗗叾甯冪疆鍒板鍙癮pache server鐨勫墠绔
nginx浠呬粎鐢ㄦ潵澶勭悊闈欐侀〉闈㈠搷搴斿拰鍔ㄦ佽姹傜殑浠g悊pass锛屽悗鍙扮殑apache server浣滀负app server鏉ュ鍓嶅彴pass杩囨潵鐨勫姩鎬侀〉闈㈣繘琛屽鐞嗗苟杩斿洖缁檔ginx銆

閫氳繃浠ヤ笂鐨勬灦鏋勶紝鎴戜滑鍙互瀹炵幇nginx鍜屽鍙癮pache鏋勬垚鐨勬満缇luster鐨勮礋杞藉潎琛°
涓ょ鍧囪 锛
1)鍙互鍦╪ginx涓畾涔夎闂笉鍚岀殑鍐呭锛屼唬鐞嗗埌涓嶅悓鐨勫悗鍙皊erver锛聽濡備笂渚嬪瓙涓殑璁块棶phpMyAdmin鐩綍浠g悊鍒扮涓鍙皊erver涓婏紱璁块棶test.php浠g悊鍒扮浜屽彴server涓婏紱
2)鍙互鍦╪ginx涓畾涔夎闂悓涓椤甸潰锛屽潎琛聽(褰撶劧濡傛灉鏈嶅姟鍣ㄦц兘涓嶅悓鍙互瀹氫箟鏉冮噸鏉ュ潎琛)鍦颁唬鐞嗗埌涓嶅悓鐨勫悗鍙皊erver涓娿聽濡備笂鐨勪緥瀛愯闂畉est.php椤甸潰锛屼細鍧囪 鍦颁唬鐞嗗埌server1鎴栬卻erver2涓娿
瀹為檯搴旂敤涓紝server1鍜宻erver2涓婂垎鍒繚鐣欑浉鍚岀殑app绋嬪簭鍜屾暟鎹紝闇瑕佽冭檻涓よ呯殑鏁版嵁鍚屾銆

鍘熸枃閾炬帴锛http://blog.csdn.net/omohe/archive/2009/07/09/4335765.aspx

SAYWO.NET鎷涜仒PHP宸ョ▼甯

PHP宸ョ▼甯/涓婃捣甯
鎵灞炶亴绫伙細浜掕仈缃戣蒋浠跺紑鍙戝伐绋嬪笀
闇姹備汉鏁帮細3浜
鍙戝竷鏃堕棿锛2009-08-18

鑱屼綅鎻忚堪

宀椾綅鑱岃矗锛
1.缃戠珯鎼缓銆佷唬鐮佺紪鍐欏強娴嬭瘯锛
2. Web绋嬪簭绯荤粺鐨勭瓥鍒掋佸紑鍙戝強娴嬭瘯锛
3. 鏀硅繘銆佸寮虹幇鏈変骇鍝佺殑鎬ц兘涓庡姛鑳斤紱
4. 缃戠珯鍚庡彴瀹炴椂缁存姢銆

浠昏亴瑕佹眰锛
1.绮鹃歅HP璇█銆丮ySQL鏁版嵁搴擄紝鐔熸倝Linux缃戠珯寮鍙戠幆澧
2.鐔熸倝Linux鎿嶄綔绯荤粺锛岀啛鎮堿pache锛岀啛鎮塎ySQL鏁版嵁搴撶殑璁捐銆佺鐞嗐佸紑鍙戝拰浼樺寲锛
3.绮鹃欳SS/HTML/XML绛夌綉椤垫妧鏈鑼冿紝鐔熸倝JavaScript/AJAX绛夊鎴风鑴氭湰璇█锛
4.鐔熸倝寮鍙戞枃妗g殑缂栧啓锛屾湁鑹ソ鏂囨。缂栧啓鑳藉姏鍜岀紪绋嬮鏍硷紝鐔熸倝鐗堟湰鎺у埗SVN鎴朇VS鐨勪娇鐢紱
5.鏈塉AVA寮鍙戠粡楠岃呬紭鍏堬紱
6.鍏锋湁Web2.0搴旂敤瀹炰緥寮鍙戠粡楠岃呬紭鍏堬紱
7.鏈1骞存垨浠ヤ笂鐩稿叧宸ヤ綔缁忛獙锛
8.鏈夊緢寮虹殑瀛︿範鑳藉姏鍜屾暚涓氱簿绁烇紝杈冨ソ鐨勬矡閫氳兘鍔涳紝鏈夎壇濂界殑鍥㈤槦鍚堜綔绮剧銆

鏈夋剰鑰咃紝璇峰彂閫佺畝鍘嗚嚦william@fantha.com

鍩轰簬OpenCV鐨凱HP鍥惧儚浜鸿劯璇嗗埆鎶鏈(杞)

鏈枃鎵浠嬬粛鐨勬妧鏈笉鏄師鍒涳紝鑰屾槸浠庝竴涓彨Robert Eisele鐨勫痉鍥戒汉閭i噷瀛︿範鏉ョ殑銆備粬鍐欎簡涓涓狿HP鎵╁睍openCV锛屽彧灏佽浜嗕袱涓嚱鏁帮紝鍙玣ace_detect鍜宖ace_count銆 openCV鏄竴涓紑婧愮殑鐢–/C++寮鍙戠殑璁$畻鏈哄浘褰㈠浘鍍忓簱锛岄潪甯稿己澶э紝鐮旂┒璧勬枡寰堥綈鍏ㄣ傛湰鏂囬噸鐐规槸浠嬬粛濡備綍浣跨敤php鏉ヨ皟鐢ㄥ叾涓殑灞閮ㄧ殑鍔熻兘銆備汉鑴镐睛鏌ユ妧鏈彧鏄痮penCV涓涓簲鐢ㄥ垎鏀

OpenCV瀹夎涔嬪墠蹇呴』渚濊禆鐨勫寘锛氾紙璇峰厛瀹夎濂斤級

pkgconfig

libpng

zlib

libjpeg

libtiff

python聽

1.瀹夎
浠庢簮浠g爜缂栬瘧鎴愪竴涓姩鎬佺殑so鏂囦欢銆

1.1.瀹夎 OpenCV (OpenCV 1.0.0)
涓嬭浇鍦板潃:http://sourceforge.net/project/showfiles.php?group_id=22870&package_id=16948

#tar xvzf OpenCV-1.0.0.tar.gz
#cd opencv-1.0.0
#./configure
#make
#make install
#make check (妫鏌ユ槸鍚﹀畨瑁呭叏閮ㄦ纭)

鎻愮ず锛 涓嶈鎸囧畾瀹夎璺緞锛屽惁鍒欏悗闈㈢紪璇慺acedetect浼氭壘涓嶅埌OpenCV鐨勮矾寰勩

1.2 瀹夎facedetect
涓嬭浇鍦板潃http://www.xarg.org/download/facedetect-1.0.0.tar.gz

#tar xzvf facedetect-1.0.0.tar.gz
#cd facedetect-1.0.0
#phpize && ./configure && make && make install

缂栬瘧瀹屼箣鍚庝細鎻愮ずfacedetect.so 鏂囦欢鎵鍦ㄧ殑浣嶇疆銆

鏈鍚庣‘璁ゅ湪php.ini鍔犲叆
extension=facedetect.so锛岄噸鍚痑pache.

2.鍑芥暟浣跨敤
鍦╬hpinfo()閲屾鏌ユ槸鍚︽湁facedetect杩欎釜妯″潡銆
浠巓penCV婧愪唬鐮/data/haarcascades/閲屽ご鍙栧嚭鎵鏈墄ml鏂囦欢鏀惧湪php鐨勬墽琛岀洰褰曚笅

  1. //妫鏌ユ湁澶氬皯涓劯鍨
  2. var_dump(face_count(‘party.jpeg’,聽haarcascade_frontalface_alt.xml’));
  3. //杩斿洖鑴稿瀷鍦ㄥ浘鐗囦腑鐨勪綅缃弬鏁帮紝澶氫釜鍒欒繑鍥炴暟缁
  4. $arr聽=聽face_detect(‘party.jpeg’,聽haarcascade_frontalface_alt2.xml’);
  5. print_r($arr);

3.搴旂敤
缁撳悎imagick鍙互灏嗗浘鐗囧仛涓涓嬪簲鐢ㄣ傚洜涓 face_detect鍙繑鍥炰竴涓煩褰㈠弬鏁帮紝鍖呭惈x锛寉鍧愭爣鍜寃锛宧闀垮鍙傛暟銆備笅闈㈡槸鎴戠殑涓涓簲鐢╠emo

imagick 鎵╁睍闇瑕佸畨瑁 ImageMagick 鍜 imagick 鎵╁睍锛岃鍙傝冿細

ImageMagick瀹樼綉锛http://www.imagemagick.org

imagick鎵╁睍涓嬭浇锛毬犅犅http://pecl.php.net/package/imagick

  1. <?php
  2. if($_FILES){
  3. $img聽=聽$_FILES['pic']['tmp_name'];
  4. $arr聽=聽face_detect($img,聽’haarcascade_frontalface_alt2.xml’);
  5. //$arr1聽=聽face_detect($img,聽’haarcascade_frontalface_alt_tree.xml’);
  6. if(is_array($arr1))聽$all聽=array_merge($arr,$arr1);
  7. else聽$all聽=聽$arr;
  8. $im聽=聽new聽Imagick($img);
  9. //$draw聽=new聽ImagickDraw();
  10. //$borderColor聽=聽new聽ImagickPixel(‘red’);
  11. //$draw->setFillAlpha(0.0);
  12. //$draw->setStrokeColor聽聽($borderColor);
  13. //$draw->setStrokeWidth聽聽(1);
  14. if(is_array($all)){
  15. 聽聽foreach聽($all聽as聽$v){
  16. 聽聽聽聽$im_cl聽=聽$im->clone();
  17. 聽聽聽聽$im_cl->cropImage($v['w'],$v['h'],$v['x'],$v['y']);
  18. 聽聽聽聽
  19. 聽聽聽聽$im_cl->swirlImage(60);
  20. 聽聽聽聽$im->compositeImage(聽$im_cl,聽Imagick::COMPOSITE_OVER聽,聽$v['x'],聽$v['y']聽);
  21. 聽聽聽聽
  22. 聽聽聽聽//$draw->rectangle($v['x'],$v['y'],$v['x']+$v['w'],$v['y']+$v['h']);
  23. 聽聽聽聽//$im->drawimage($draw);
  24. 聽聽聽聽
  25. 聽聽聽聽
  26. 聽聽}
  27. }
  28. 聽聽header(聽”Content-Type:聽image/png”聽);
  29. 聽聽echo聽$im;
  30. }else{
  31. 聽聽?>
  32. 聽聽<meta聽http-equiv=”Content-Type”聽content=”text/html;聽charset=utf-8″聽/>
  33. 聽聽<form聽method=”POST”聽enctype=”multipart/form-data”>
  34. 聽聽浜鸿劯璇嗗埆璇曢獙锛氬彧鏀寔jpg,png<br>
  35. 聽聽涓婁紶涓寮犲浘鐗嚶<input聽type=”file”聽name=”pic”>
  36. 聽聽<input聽type=”submit”聽value=”upload”>
  37. 聽聽</form>
  38. 聽聽<?
  39. }
  40. ?>

鍙傝冭祫鏂:
http://www.xarg.org/2008/07/face-detection-with-php/
http://www.opencv.org.cn/index.php/棣栭〉
http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/index.html

浠ヤ笂鏂囩珷鏉ユ簮锛http://blog.csdn.net/zhongmao/archive/2009/01/11/3753377.aspx

浣跨敤娴嬭瘯

瀹夎娴嬭瘯浜嗕竴涓嬶紝濡傛灉瓒婃槸楂樻竻鐨勫ぇ鍥撅紝鏁堟灉瓒婃槑鏄撅紝鎰熻涓嶉敊

涓 瀹夎
1 瀹夎opencv

http://sourceforge.net/project/showfiles.php?group_id=22870&package_id=16948

涓嬭浇opencv-1.1pre1.tar.gz锛1.0鐗堟湰娌℃湁瀹夎鎴愬姛锛
#tar zxvf opencv-1.1pre1.tar.gz
# cd opencv-1.1.0/
# /.configure
#make
#make install

2 瀹夎facedetect
#wget http://www.xarg.org/download/facedetect-1.0.0.tar.gz
#tar xzvf facedetect-1.0.0.tar.gz
#cd facedetect-1.0.0
#/usr/local/php/bin/phpize
#./configure 鈥搘ith-php-config=/usr/local/php/bin/php-config
#make
#make install

#vi /usr/local/php/etc/php.ini
// 澧炲姞extension=facedetect.so

3 閲嶅惎web鏈嶅姟鍣紝鍦╬hpinfo()閲屾煡鐪嬫槸鍚︽湁facedetect杩欎釜妯″潡

浜 绠鍗曟祴璇
浠巓penCV婧愪唬鐮/data/haarcascades/閲屽ご鍙栧嚭鎵鏈墄ml鏂囦欢鏀惧湪php鐨勬墽琛岀洰褰曚笅

//妫鏌ユ湁澶氬皯涓劯鍨
var_dump(face_count(鈥檛est.jpg鈥, 鈥榟aarcascade_frontalface_alt.xml鈥));

//杩斿洖鑴稿瀷鍦ㄥ浘鐗囦腑鐨勪綅缃弬鏁帮紝澶氫釜鍒欒繑鍥炴暟缁
$arr = face_detect(鈥檛est.jpg鈥, 鈥榟aarcascade_frontalface_alt2.xml鈥);

print_r($arr);

涓 娴嬭瘯浠g爜
<?
if(empty($_POST)) {
?>
<form name=鈥漟orm鈥 id=鈥漟orm鈥 method=鈥漃OST鈥 enctype=鈥漨ultipart/form-data鈥 action=鈥”>
涓婁紶鍥剧墖锛<input type=鈥漟ile鈥 name=鈥漰ic鈥 size=鈥20鈥><input type=鈥漵ubmit鈥 name=鈥漵ubmit鈥 value=鈥濅笂浼犫>
</form>
<?
} else {
$img = $_FILES['pic']['tmp_name'];

$arr = face_detect($img, 鈥榟aarcascade_frontalface_alt2.xml鈥);

if(is_array($arr1)) {
$all = array_merge($arr,$arr1);
} else {
$all = $arr;
}
$allowtype = 1;
switch($_FILES['pic']['type']){
case 鈥榠mage/pjpeg鈥: $fix_pic.= 鈥.jpg鈥; break;
case 鈥榠mage/jpeg鈥: $fix_pic.= 鈥.jpg鈥; break;
case 鈥榠mage/x-png鈥: $fix_pic.= 鈥.png鈥; break;
case 鈥榠mage/png鈥: $fix_pic.= 鈥.png鈥; break;
default: $allowtype = 0; break;
}

if($allowtype == 0) {
echo 鈥滄枃浠舵牸寮忛敊璇細鍙繍琛宩pg鎴杙ng鍥剧墖鈥;exit;
}

$tmp_name = time();
$src_pic = 鈥/usr/website/nginx/face/haarcascades/upload/鈥.$tmp_name.$fix_pic;
move_uploaded_file($_FILES['pic']['tmp_name'], $src_pic);

$pic_src = $pic_dst = array();
if(is_array($all)){
foreach ($all as $k => $v){
$tmp_name_new = $tmp_name.鈥漘鈥.$k;
$x = $v['x'];
$y = $v['y'];
$w = $v['w'];
$h = $v['h'];
$dst_pic = 鈥/usr/website/nginx/face/haarcascades/upload/鈥.$tmp_name_new.$fix_pic;
// echo $src_pic.鈥<br>鈥;
// echo $dst_pic.鈥<br>鈥;
$cmd = 鈥/usr/bin/convert -crop 鈥.$w.鈥漻鈥.$h.鈥+鈥.$x.鈥+鈥.$y.鈥 鈥.$src_pic.鈥 鈥.$dst_pic;
// echo $cmd.鈥<br>鈥;
echo `$cmd`;
$pic_src[] = 鈥渦pload/鈥.$tmp_name.$fix_pic;
$pic_dst[] = 鈥渦pload/鈥.$tmp_name_new.$fix_pic;
}
}

foreach($pic_src as $key => $value) {
echo 鈥<img src=鈥欌.$value.鈥濃> => <img src=鈥欌.$pic_dst[$key].鈥濃><br>鈥;
}
}
?>

浠ヤ笂鏂囩珷鏉ユ簮锛http://www.sysbus.com/?p=124

PHP鏁寸悊鏄剧ず鐓х墖exif淇℃伅(杞)

HP鏁寸悊鏄剧ず鐓х墖exif淇℃伅锛岀粷瀵瑰ソ涓滆タ銆

* 鑾峰彇鍥捐薄淇℃伅鐨勫嚱鏁
*
* 涓涓叏闈㈣幏鍙栧浘璞′俊鎭殑鍑芥暟
*
* @access public
* @param string $img 鍥剧墖璺緞
* @return array

< ?php
/**
* 鑾峰彇鍥捐薄淇℃伅鐨勫嚱鏁
*
* 涓涓叏闈㈣幏鍙栧浘璞′俊鎭殑鍑芥暟
*
* @access public
* @param string $img 鍥剧墖璺緞
* @return array
*/
function GetImageInfoVal($ImageInfo,$val_arr) {
聽聽 聽$InfoVal = “鏈煡”;
聽聽 聽foreach($val_arr as $name=>$val) {
聽聽 聽if ($name==$ImageInfo) {
聽聽 聽$InfoVal = &$val;
聽聽 聽break;
聽聽 聽}
聽聽 聽}
聽聽 聽return $InfoVal;
}
function GetImageInfo($img) {
聽聽 聽

聽聽 聽
聽聽 聽$imgtype = array(“”, “GIF”, “JPG”, “PNG”, “SWF”, “PSD”, “BMP”, “TIFF(intel byte order)”, “TIFF(motorola byte order)”, “JPC”, “JP2″, “JPX”, “JB2″, “SWC”, “IFF”, “WBMP”, “XBM”);
聽聽 聽$Orientation = array(“”, “top left side”, “top right side”, “bottom right side”, “bottom left side”, “left side top”, “right side top”, “right side bottom”, “left side bottom”);
聽聽 聽$ResolutionUnit = array(“”, “”, “鑻卞”, “鍘樼背”);
聽聽 聽$YCbCrPositioning = array(“”, “the center of pixel array”, “the datum point”);
聽聽 聽$ExposureProgram = array(“鏈畾涔”, “鎵嬪姩”, “鏍囧噯绋嬪簭”, “鍏夊湀鍏堝喅”, “蹇棬鍏堝喅”, “鏅繁鍏堝喅”, “杩愬姩妯″紡”, “鑲栧儚妯″紡”, “椋庢櫙妯″紡”);
聽聽 聽$MeteringMode_arr = array(
聽聽 聽”0″ => “鏈煡”,
聽聽 聽”1″ => “骞冲潎”,
聽聽 聽”2″ => “涓ぎ閲嶇偣骞冲潎娴嬪厜”,
聽聽 聽”3″ => “鐐规祴”,
聽聽 聽”4″ => “鍒嗗尯”,
聽聽 聽”5″ => “璇勪及”,
聽聽 聽”6″ => “灞閮”,
聽聽 聽”255″ => “鍏朵粬”
聽聽 聽);
聽聽 聽$Lightsource_arr = array(
聽聽 聽”0″ => “鏈煡”,
聽聽 聽”1″ => “鏃ュ厜”,
聽聽 聽”2″ => “鑽у厜鐏”,
聽聽 聽”3″ => “閽ㄤ笣鐏”,
聽聽 聽”10″ => “闂厜鐏”,
聽聽 聽”17″ => “鏍囧噯鐏厜A”,
聽聽 聽”18″ => “鏍囧噯鐏厜B”,
聽聽 聽”19″ => “鏍囧噯鐏厜C”,
聽聽 聽”20″ => “D55″,
聽聽 聽”21″ => “D65″,
聽聽 聽”22″ => “D75″,
聽聽 聽”255″ => “鍏朵粬”
聽聽 聽);
聽聽 聽$Flash_arr = array(
聽聽 聽”0″ => “flash did not fire”,
聽聽 聽”1″ => “flash fired”,
聽聽 聽”5″ => “flash fired but strobe return light not detected”,
聽聽 聽”7″ => “flash fired and strobe return light detected”,
聽聽 聽);
聽聽 聽
聽聽 聽$exif = exif_read_data ($img,”IFD0″);
聽聽 聽if ($exif===false) {
聽聽 聽$new_img_info = array (“鏂囦欢淇℃伅” => “娌℃湁鍥剧墖EXIF淇℃伅”);
聽聽 聽}
聽聽 聽else
聽聽 聽{
聽聽 聽$exif = exif_read_data ($img,0,true);
聽聽 聽$new_img_info = array (
聽聽 聽”鏂囦欢淇℃伅” => “—————————–”,
聽聽 聽”鏂囦欢鍚” => $exif[FILE][FileName],
聽聽 聽”鏂囦欢绫诲瀷” => $imgtype[$exif[FILE][FileType]],
聽聽 聽”鏂囦欢鏍煎紡” => $exif[FILE][MimeType],
聽聽 聽”鏂囦欢澶у皬” => $exif[FILE][FileSize],
聽聽 聽”鏃堕棿鎴” => date(“Y-m-d H:i:s”,$exif[FILE][FileDateTime]),
聽聽 聽”鍥惧儚淇℃伅” => “—————————–”,
聽聽 聽”鍥剧墖璇存槑” => $exif[IFD0][ImageDescription],
聽聽 聽”鍒堕犲晢” => $exif[IFD0][Make],
聽聽 聽”鍨嬪彿” => $exif[IFD0][Model],
聽聽 聽”鏂瑰悜” => $Orientation[$exif[IFD0][Orientation]],
聽聽 聽”姘村钩鍒嗚鲸鐜” => $exif[IFD0][XResolution].$ResolutionUnit[$exif[IFD0][ResolutionUnit]],
聽聽 聽”鍨傜洿鍒嗚鲸鐜” => $exif[IFD0][YResolution].$ResolutionUnit[$exif[IFD0][ResolutionUnit]],
聽聽 聽”鍒涘缓杞欢” => $exif[IFD0][Software],
聽聽 聽”淇敼鏃堕棿” => $exif[IFD0][DateTime],
聽聽 聽”浣滆” => $exif[IFD0][Artist],
聽聽 聽”YCbCr浣嶇疆鎺у埗” => $YCbCrPositioning[$exif[IFD0][YCbCrPositioning]],
聽聽 聽”鐗堟潈” => $exif[IFD0][Copyright],
聽聽 聽”鎽勫奖鐗堟潈” => $exif[COMPUTED][Copyright.Photographer],
聽聽 聽”缂栬緫鐗堟潈” => $exif[COMPUTED][Copyright.Editor],
聽聽 聽”鎷嶆憚淇℃伅” => “—————————–”,
聽聽 聽”Exif鐗堟湰” => $exif[EXIF][ExifVersion],
聽聽 聽”FlashPix鐗堟湰” => “Ver. “.number_format($exif[EXIF][FlashPixVersion]/100,2),
聽聽 聽”鎷嶆憚鏃堕棿” => $exif[EXIF][DateTimeOriginal],
聽聽 聽”鏁板瓧鍖栨椂闂” => $exif[EXIF][DateTimeDigitized],
聽聽 聽”鎷嶆憚鍒嗚鲸鐜囬珮” => $exif[COMPUTED][Height],
聽聽 聽”鎷嶆憚鍒嗚鲸鐜囧” => $exif[COMPUTED][Width],
聽聽 聽/*
聽聽 聽The actual aperture value of lens when the image was taken.
聽聽 聽Unit is APEX.
聽聽 聽To convert this value to ordinary F-number(F-stop),
聽聽 聽calculate this value’s power of root 2 (=1.4142).
聽聽 聽For example, if the ApertureValue is ‘5′, F-number is pow(1.41425,5) = F5.6.
聽聽 聽*/
聽聽 聽”鍏夊湀” => $exif[EXIF][ApertureValue],
聽聽 聽”蹇棬閫熷害” => $exif[EXIF][ShutterSpeedValue],
聽聽 聽”蹇棬鍏夊湀” => $exif[COMPUTED][ApertureFNumber],
聽聽 聽”鏈澶у厜鍦堝” => “F”.$exif[EXIF][MaxApertureValue],
聽聽 聽”鏇濆厜鏃堕棿” => $exif[EXIF][ExposureTime],
聽聽 聽”F-Number” => $exif[EXIF][FNumber],
聽聽 聽”娴嬪厜妯″紡” => GetImageInfoVal($exif[EXIF][MeteringMode],$MeteringMode_arr),
聽聽 聽”鍏夋簮” => GetImageInfoVal($exif[EXIF][LightSource], $Lightsource_arr),
聽聽 聽”闂厜鐏” => GetImageInfoVal($exif[EXIF][Flash], $Flash_arr),
聽聽 聽”鏇濆厜妯″紡” => ($exif[EXIF][ExposureMode]==1?”鎵嬪姩”:”鑷姩”),
聽聽 聽”鐧藉钩琛” => ($exif[EXIF][WhiteBalance]==1?”鎵嬪姩”:”鑷姩”),
聽聽 聽”鏇濆厜绋嬪簭” => $ExposureProgram[$exif[EXIF][ExposureProgram]],
聽聽 聽/*
聽聽 聽Brightness of taken subject, unit is APEX. To calculate Exposure(Ev) from BrigtnessValue(Bv), you must add SensitivityValue(Sv).
聽聽 聽Ev=Bv+Sv Sv=log((ISOSpeedRating/3.125),2)
聽聽 聽ISO100:Sv=5, ISO200:Sv=6, ISO400:Sv=7, ISO125:Sv=5.32.聽
聽聽 聽*/
聽聽 聽”鏇濆厜琛ュ伩” => $exif[EXIF][ExposureBiasValue].”EV”,
聽聽 聽”ISO鎰熷厜搴” => $exif[EXIF][ISOSpeedRatings],
聽聽 聽”鍒嗛噺閰嶇疆” => (bin2hex($exif[EXIF][ComponentsConfiguration])==”01020300″?”YCbCr”:”RGB”),//’0×04,0×05,0×06,0×00′=”RGB” ‘0×01,0×02,0×03,0×00′=”YCbCr”
聽聽 聽”鍥惧儚鍘嬬缉鐜” => $exif[EXIF][CompressedBitsPerPixel].”Bits/Pixel”,
聽聽 聽”瀵圭劍璺濈” => $exif[COMPUTED][FocusDistance].”m”,
聽聽 聽”鐒﹁窛” => $exif[EXIF][FocalLength].”mm”,
聽聽 聽”绛変环35mm鐒﹁窛” => $exif[EXIF][FocalLengthIn35mmFilm].”mm”,
聽聽 聽/*
聽聽 聽Stores user comment. This tag allows to use two-byte character code or unicode. First 8 bytes describe the character code. ‘JIS’ is a Japanese character code (known as Kanji).
聽聽 聽’0×41,0×53,0×43,0×49,0×49,0×00,0×00,0×00′:ASCII
聽聽 聽’0×4a,0×49,0×53,0×00,0×00,0×00,0×00,0×00′:JIS
聽聽 聽’0×55,0×4e,0×49,0×43,0×4f,0×44,0×45,0×00′:Unicode
聽聽 聽’0×00,0×00,0×00,0×00,0×00,0×00,0×00,0×00′:Undefined
聽聽 聽*/
聽聽 聽”鐢ㄦ埛娉ㄩ噴缂栫爜” => $exif[COMPUTED][UserCommentEncoding],
聽聽 聽”鐢ㄦ埛娉ㄩ噴” => $exif[COMPUTED][UserComment],
聽聽 聽”鑹插僵绌洪棿” => ($exif[EXIF][ColorSpace]==1?”sRGB”:”Uncalibrated”),
聽聽 聽”Exif鍥惧儚瀹藉害” => $exif[EXIF][ExifImageLength],
聽聽 聽”Exif鍥惧儚楂樺害” => $exif[EXIF][ExifImageWidth],
聽聽 聽”鏂囦欢鏉ユ簮” => (bin2hex($exif[EXIF][FileSource])==0×03?”digital still camera”:”unknown”),
聽聽 聽”鍦烘櫙绫诲瀷” => (bin2hex($exif[EXIF][SceneType])==0×01?”A directly photographed image”:”unknown”),
聽聽 聽”缂╃暐鍥炬枃浠舵牸寮” => $exif[COMPUTED][Thumbnail.FileType],
聽聽 聽”缂╃暐鍥綧ime鏍煎紡” => $exif[COMPUTED][Thumbnail.MimeType]
聽聽 聽);
聽聽 聽}
聽聽 聽return $new_img_info;
}

$innerhtml = “”;
$exif = GetImageInfo($_GET['img']);
$innerhtml .= “<table>”;

foreach($exif as $name=>$val) {
聽聽 聽$innerhtml .= “<tr><td>{$name}</td><td>{$val}</td></tr>”;
}

$innerhtml .= “<tr><td colspan=\”2\”>”;
if ($_GET['img']) {
聽聽 聽$image = exif_thumbnail($_GET['img']);
} else {
聽聽 聽$image = false;
}
if ($image!==false) {
聽聽 聽$innerhtml .= “<img src=\”thumbnail.php?img=”.$_GET['img'].”\”/>”;
} else {
聽聽 聽// no thumbnail available, handle the error here
聽聽 聽$innerhtml .= “No thumbnail available”;
}

$innerhtml .= “</td></tr></table>”;
?>
<html>
<head>聽
<title>鍥剧墖淇℃伅</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=??????”>
</meta></head>
<body>
<script>
<!–
//鍒濆鍖栧唴瀹瑰
parent.followTd<?=$_GET['r_id'];?>.innerHTML=’< ?=$innerhtml;?>’;
//宸茶鍙
parent.document.images.followImg< ?=$_GET['r_id'];?>.loaded=’yes’;
–>
</script>
</body>
</html>

Linux鏌ョ湅绯荤粺閰嶇疆甯哥敤鍛戒护

绯荤粺

# uname -a聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鍐呮牳/鎿嶄綔绯荤粺/CPU淇℃伅
# head -n 1 /etc/issue聽聽 # 鏌ョ湅鎿嶄綔绯荤粺鐗堟湰
# cat /proc/cpuinfo聽聽聽聽聽 # 鏌ョ湅CPU淇℃伅
# hostname聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅璁$畻鏈哄悕
# lspci -tv聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鍒楀嚭鎵鏈塒CI璁惧
# lsusb -tv聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鍒楀嚭鎵鏈塙SB璁惧
# lsmod聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鍒楀嚭鍔犺浇鐨勫唴鏍告ā鍧
# env聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鐜鍙橀噺

璧勬簮

# free -m聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鍐呭瓨浣跨敤閲忓拰浜ゆ崲鍖轰娇鐢ㄩ噺
# df -h聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鍚勫垎鍖轰娇鐢ㄦ儏鍐
# du -sh <鐩綍鍚>聽聽聽聽聽聽聽 # 鏌ョ湅鎸囧畾鐩綍鐨勫ぇ灏
# grep MemTotal /proc/meminfo聽聽 # 鏌ョ湅鍐呭瓨鎬婚噺
# grep MemFree /proc/meminfo聽聽聽 # 鏌ョ湅绌洪棽鍐呭瓨閲
# uptime聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅绯荤粺杩愯鏃堕棿銆佺敤鎴锋暟銆佽礋杞
# cat /proc/loadavg聽聽聽聽聽 # 鏌ョ湅绯荤粺璐熻浇

纾佺洏鍜屽垎鍖

# mount | column -t聽聽聽聽聽 # 鏌ョ湅鎸傛帴鐨勫垎鍖虹姸鎬
# fdisk -l聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鎵鏈夊垎鍖
# swapon -s聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鎵鏈変氦鎹㈠垎鍖
# hdparm -i /dev/hda聽聽聽聽 # 鏌ョ湅纾佺洏鍙傛暟(浠呴傜敤浜嶪DE璁惧)
# dmesg | grep IDE聽聽聽聽聽聽 # 鏌ョ湅鍚姩鏃禝DE璁惧妫娴嬬姸鍐

缃戠粶

# ifconfig聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鎵鏈夌綉缁滄帴鍙g殑灞炴
# iptables -L聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅闃茬伀澧欒缃
# route -n聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅璺敱琛
# netstat -lntp聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鎵鏈夌洃鍚鍙
# netstat -antp聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鎵鏈夊凡缁忓缓绔嬬殑杩炴帴
# netstat -s聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅缃戠粶缁熻淇℃伅

杩涚▼

# ps -ef聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鎵鏈夎繘绋
# top聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 瀹炴椂鏄剧ず杩涚▼鐘舵

鐢ㄦ埛

# w聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅娲诲姩鐢ㄦ埛
# id <鐢ㄦ埛鍚>聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鎸囧畾鐢ㄦ埛淇℃伅
# last聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鐢ㄦ埛鐧诲綍鏃ュ織
# cut -d: -f1 /etc/passwd聽聽 # 鏌ョ湅绯荤粺鎵鏈夌敤鎴
# cut -d: -f1 /etc/group聽聽聽 # 鏌ョ湅绯荤粺鎵鏈夌粍
# crontab -l聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅褰撳墠鐢ㄦ埛鐨勮鍒掍换鍔

鏈嶅姟

# chkconfig –list聽聽聽聽聽聽 # 鍒楀嚭鎵鏈夌郴缁熸湇鍔
# chkconfig –list | grep on聽聽聽 # 鍒楀嚭鎵鏈夊惎鍔ㄧ殑绯荤粺鏈嶅姟

绋嬪簭

# rpm -qa聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 # 鏌ョ湅鎵鏈夊畨瑁呯殑杞欢鍖

Q: 褰撳湪鍙︿竴鍙版満鍣ㄤ笂鐧诲綍MySQL鏃跺嚭鐜板涓嬮敊璇細

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘x.x.x.x’ (111)

A: 鍘熷洜鏄疢ySQL鑰冭檻鍒板畨鍏ㄥ洜绱狅紝榛樿閰嶇疆鍙浠庢湰鍦扮櫥褰

鎵撳紑 /etc/mysql/my.cnf 鏂囦欢锛屾壘鍒 bind-address = 127.0.0.1 淇敼涓 bind-address = 0.0.0.0

閲嶅惎mysql : sudo /etc/init.d/mysql restart

鍙弬鑰冿細

> I’ve already check my /etc/my.cnf file for a “binding”
> line. Its not聽
> there. I also found an item online that indicated
> adding:
>

Look for the option “skip-networking”. This disables TCP/IP so the聽
server only accepts local connections via the Unix socket. This sounds聽
like your situation.
Note that a “could not connect” error means just that. If the problem聽
was related to user privileges you would get an “access denied” error.

Q: 杩樹竴绉嶆儏鍐靛嚭鐜扮被浼间笅闈㈢殑閿欒锛

ERROR 1045 (28000): Access denied for user ‘test’@'x.x.x.x’ (using password: NO)

A: 鍘熷洜鏄病鏈夌粰鐧诲綍鐢ㄦ埛鍚嶈缃繙绋嬩富鏈虹櫥褰曠殑鏉冮檺銆

鍦ㄦ湰鍦扮敤 root 鐧诲綍: mysql -u root -p

淇敼 MySQL 鏁版嵁搴撲腑 user 琛ㄤ腑 瀵瑰簲鐢ㄦ埛鍚嶇殑 Host 瀛楁锛屽皢 localhost 鏀逛负 %

use mysql;

update user set Host = ‘%’ where User = ‘username’;

Ubuntu 8.04 绯荤粺瀹夎APACHE PHP MYSQL(杞)

1銆瀹夎聽Apache2+PHP5+MySQL

sudo apt-get install apache2 libapache2-mod-php5聽php5聽php5-gd mysql-server聽php5-mysql phpmyadmin

joelhy 鎻愰啋 杩欎竴姝ュ彲浠ヤ娇鐢ㄦ柊绔嬪緱鏉瀹夎锛屽悓鏍锋晥鏋溿

鎵撳紑鏂扮珛寰楋紝缂栬緫 鈥> 浣跨敤浠诲姟鍒嗙粍鏍囪杞欢鍖 鈥> 鍕鹃 LAMP Server

鐒跺悗鍐嶅崟鐙瀹夎聽phpmyadmin

sudo apt-get install phpmyadmin

2銆佸惎鐢 mod_rewrite 妯″潡

sudo a2enmod rewrite

3銆侀厤缃 apache2.conf

sudo gedit /etc/apache2/apache2.conf

鍘绘帀 AddHandler cgi-script .cgi 鍓嶇殑娉ㄩ噴 鈥#鈥濄

鐒跺悗鍦ㄤ换鎰忓湴鏂规坊鍔犺繖涔堜竴娈碉細

<Virtualhost localhost>
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /var/www/cgi-bin/>
Options ExecCGI
</Directory>
</Virtualhost>閲嶅惎鏈嶅姟鍣

sudo /etc/init.d/apache2 restart

鎼炲畾銆

璇存槑锛PHP聽绋嬪簭鏀 /var/www/ 涓嬮潰閮藉彲浠ワ紝CGI 绋嬪簭鏀 /var/www/cgi-bin/ 涓嬮潰銆

鏄笉鏄お绠鍗曚簡锛岄櫎鍘讳笅杞界殑鏃堕棿锛岃涓嶄簡涓鍒嗛挓灏卞彲浠ュ畬鎴愰厤缃紝鍦Ubuntu聽涓婅繕闇瑕 APM 鍖呭悧锛熻繕鏄浣忎互涓嬪嚑涓懡浠ゅ拰浣嶇疆灏辫浜嗐

sudo /etc/init.d/apache2 restart 锛堥噸鍚 apache锛

sudo gedit /etc/php5/apache2/php.ini 锛堥厤缃php.ini锛

sudo gedit /etc/apache2/apache2.conf 锛堥厤缃 apache2.conf锛

/var/www/锛堜富鐩綍浣嶇疆锛

Q:聽ERROR 1130 (00000): Host X is not allowed to connect to this MySQL server

A:聽杩欑闂涓鑸嚭鐜板湪杩滅▼鐧诲綍鏁版嵁搴撶殑鏃跺欍傚師鍥犳槸鐢变簬杩炴帴mysql鏁版嵁搴撶殑鐢ㄦ埛鍚嶇殑鏉冮檺涓嶅锛屽彲浠ュ湪鏈嶅姟鍣ㄤ笂鐢╮oot鐢ㄦ埛鐧诲綍锛屾煡鐪媘ysql鏁版嵁搴撶殑user琛紝淇敼瀵瑰簲鐢ㄦ埛鐨刪ost鍒楃殑鍊间负%(榛樿鐨勪负localhost)銆傜浉搴旂殑sql璇彞涓:
use mysql;
update user set host=’%’ where user=’connect name‘;
flush privileges;
exit

Q:Ubuntu聽涓嬪畨瑁phpmyadmin聽鍗存棤娉曚娇鐢

A:聽瀹夎phpmyadmin鍛戒护锛歴udo apt-get install聽phpmyadmin
榛樿瀹夎鍦 /usr/share/phpmyadmin
浣滀釜閾炬帴鍒 /var/www/ 鐩綍涓嬶紝鍛戒护涓猴細sudo ln -s /usr/share/phpmyadmin/ /var/www/
鍐嶄娇鐢 http://localhost/phpmyadmin聽鍗冲彲浠ヨ闂簡銆

Q:聽apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName

A:杩欐槸涓涓 warning锛屽嚭鐜板湪apache2鍚姩鎴栭噸璧锋椂銆備富瑕佹槸鍥犱负鍦ㄩ厤缃 apache2 鏃讹紝娌℃湁鎸囧畾鐩稿簲鐨勪富鏈哄悕锛屽嵆 ServerName銆備慨鏀 /etc/apache2/httpd.conf , 鍦ㄦ渶鍓嶅姞鍏 ServerName localhost:80 鍗冲彲銆

Q:Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent

A:杩欐槸鐢变簬鍦ㄩ〉闈腑浣跨敤 session_start() 鐨勪綅缃病鏈夋斁瀵癸紝鎸夊畼鏂规枃妗g殑璇存硶锛欼f you are using cookie-based sessions, you must call聽session_start()聽before anything is outputted to the browser
鎵浠ワ紝鍙互鎶<?php session_start();?>鏀惧湪椤甸潰鐨勬渶鍓嶉潰鍗冲彲锛屾敞鎰<?php 鍓嶄笉瑕佹湁绌烘牸銆

Q:Warning:聽Cannot modify header information – headers already sent

A:鐢变簬鍦ㄩ〉闈腑浣跨敤浜 header() 锛屾寜瀹樻柟鏂囨。 鐨勮娉曪細 Remember that聽header()聽must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before聽header()聽is called. The same problem exists when using a single PHP/HTML file.
鍙﹀瀵逛簬 header(“Location:”) 鐨勭敤娉曪紝鍦ㄤ笅涓琛岀敤exit;浠ヤ娇鍚庨潰鐨勫唴瀹逛笉浼氳鎵ц銆
濡傦細
<?php
header("Location: http://www.example.com/"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>

Ubuntu锛氬叧鏈哄懡浠よ瑙(杞)

Linux绯荤粺涓殑鍏虫満鍛戒护聽
鍑犵鍏虫満鏂瑰紡锛屼粈涔坰hutdown锛宺eboot锛宨nit..閮芥湁閮芥湁銆傘偮

Tags: linux 鍏虫満 shotdonw reboot init halt聽
鍦↙inux涓嬩竴浜涘父鐢ㄧ殑鍏虫満/閲嶅惎鍛戒护鏈塻hutdown銆乭alt銆乺eboot銆佸強init锛屽畠浠兘鍙互杈惧埌閲嶅惎绯荤粺鐨勭洰鐨勶紝浣嗘瘡涓懡浠ょ殑鍐呴儴宸ヤ綔杩囩▼鏄笉鍚岀殑锛岄氳繃鏈枃鐨勪粙缁嶏紝甯屾湜浣犲彲浠ユ洿鍔犵伒娲荤殑杩愮敤鍚勭鍏虫満鍛戒护銆偮
聽聽
1.shutdown聽
聽聽
shutdown鍛戒护瀹夊叏鍦板皢绯荤粺鍏虫満銆傛湁浜涚敤鎴蜂細浣跨敤鐩存帴鏂帀鐢垫簮鐨勬柟寮忔潵鍏抽棴linux锛岃繖鏄崄鍒嗗嵄闄╃殑銆傚洜涓簂inux涓巜indows涓嶅悓锛屽叾鍚庡彴杩愯鐫璁稿杩涚▼锛屾墍浠ュ己鍒跺叧鏈哄彲鑳戒細瀵艰嚧杩涚▼鐨勬暟鎹涪澶憋箰浣跨郴缁熷浜庝笉绋冲畾鐨勭姸鎬侊箰鐢氳嚦鍦ㄦ湁鐨勭郴缁熶腑浼氭崯鍧忕‖浠惰澶囥傝屽湪绯荤粺鍏虫満鍓嶄娇鐢╯hutdown鍛戒护锕愮郴缁熺鐞嗗憳浼氶氱煡鎵鏈夌櫥褰曠殑鐢ㄦ埛绯荤粺灏嗚鍏抽棴銆傚苟涓攍ogin鎸囦护浼氳鍐荤粨锕愬嵆鏂扮殑鐢ㄦ埛涓嶈兘鍐嶇櫥褰曘傜洿鎺ュ叧鏈烘垨鑰呭欢杩熶竴瀹氱殑鏃堕棿鎵嶅叧鏈洪兘鏄彲鑳界殑锕愯繕鍙兘閲嶅惎銆傝繖鏄敱鎵鏈夎繘绋嬨攑rocess銆曢兘浼氭敹鍒扮郴缁熸墍閫佽揪鐨勪俊鍙枫攕ignal鍐冲畾鐨勩傝繖璁╁儚vi涔嬬被鐨勭▼搴忔湁鏃堕棿鍌ㄥ瓨鐩墠姝e湪缂栬緫鐨勬枃妗o箰鑰屽儚澶勭悊閭欢銆攎ail銆曞拰鏂伴椈銆攏ews銆曠殑绋嬪簭鍒欏彲浠ユ甯稿湴绂诲紑绛夌瓑銆偮
聽聽
shutdown鎵ц瀹冪殑宸ヤ綔鏄佷俊鍙枫攕ignal銆曠粰init绋嬪簭锕愯姹傚畠鏀瑰彉runlevel銆俁unlevel 0琚敤鏉ュ仠鏈恒攈alt銆曪箰runlevel 6鏄敤鏉ラ噸鏂版縺娲汇攔eboot銆曠郴缁燂箰鑰宺unlevel 1鍒欐槸琚敤鏉ヨ绯荤粺杩涘叆绠$悊宸ヤ綔鍙互杩涜鐨勭姸鎬侊箶杩欐槸棰勮鐨勶箰鍋囧畾娌℃湁-h涔熸病鏈-r鍙傛暟缁檚hutdown銆傝鎯充簡瑙e湪鍋滄満銆攈alt銆曟垨鑰呴噸鏂板紑鏈恒攔eboot銆曡繃绋嬩腑鍋氫簡鍝簺鍔ㄤ綔锕愪綘鍙互鍦ㄨ繖涓枃浠/etc/inittab閲岀湅鍒拌繖浜況unlevels鐩稿叧鐨勮祫鏂欍偮
聽聽
shutdown 鍙傛暟璇存槑:聽
聽聽
[-t] 鍦ㄦ敼鍙樺埌鍏跺畠runlevel涔嬪墠锕愬憡璇塱nit澶氫箙浠ュ悗鍏虫満銆偮
聽聽
[-r] 閲嶅惎璁$畻鍣ㄣ偮
聽聽
[-k] 骞朵笉鐪熸鍏虫満锕愬彧鏄佽鍛婁俊鍙风粰姣忎綅鐧诲綍鑰呫攍ogin銆曘偮
聽聽
[-h] 鍏虫満鍚庡叧闂數婧愩攈alt銆曘偮
聽聽
[-n] 涓嶇敤init锕愯屾槸鑷繁鏉ュ叧鏈恒備笉榧撳姳浣跨敤杩欎釜閫夐」锕愯屼笖璇ラ夐」鎵浜х敓鐨勫悗鏋滃線寰涓嶆绘槸浣犳墍棰勬湡寰楀埌鐨勩偮
聽聽
[-c] cancel current process鍙栨秷鐩墠姝e湪鎵ц鐨勫叧鏈虹▼搴忋傛墍浠ヨ繖涓夐」褰撶劧娌℃湁鏃堕棿鍙傛暟锕愪絾鏄彲浠ヨ緭鍏ヤ竴涓敤鏉ヨВ閲婄殑璁伅锕愯岃繖淇℃伅灏嗕細閫佸埌姣忎綅浣跨敤鑰呫偮
聽聽
[-f] 鍦ㄩ噸鍚绠楀櫒銆攔eboot銆曟椂蹇界暐fsck銆偮
聽聽
[-F] 鍦ㄩ噸鍚绠楀櫒銆攔eboot銆曟椂寮鸿揩fsck銆偮
聽聽
[-time] 璁惧畾鍏虫満銆攕hutdown銆曞墠鐨勬椂闂淬偮
聽聽
2.halt—-鏈绠鍗曠殑鍏虫満鍛戒护聽
聽聽
鍏跺疄halt灏辨槸璋冪敤shutdown -h銆俬alt鎵ц鏃讹箰鏉姝诲簲鐢ㄨ繘绋嬶箰鎵цsync绯荤粺璋冪敤锕愭枃浠剁郴缁熷啓鎿嶄綔瀹屾垚鍚庡氨浼氬仠姝㈠唴鏍搞偮
聽聽
鍙傛暟璇存槑:聽
聽聽
[-n] 闃叉sync绯荤粺璋冪敤锕愬畠鐢ㄥ湪鐢╢sck淇ˉ鏍瑰垎鍖轰箣鍚庯箰浠ラ樆姝㈠唴鏍哥敤鑰佺増鏈殑瓒呯骇鍧椼攕uperblock銆曡鐩栦慨琛ヨ繃鐨勮秴绾у潡銆偮
聽聽
[-w] 骞朵笉鏄湡姝g殑閲嶅惎鎴栧叧鏈猴箰鍙槸鍐檞tmp銆/var/log/wtmp銆曠邯褰曘偮
聽聽
[-d] 涓嶅啓wtmp绾綍銆斿凡鍖呭惈鍦ㄩ夐」[-n]涓曘偮
聽聽
[-f] 娌℃湁璋冪敤shutdown鑰屽己鍒跺叧鏈烘垨閲嶅惎銆偮
聽聽
[-i] 鍏虫満銆旀垨閲嶅惎銆曞墠锕愬叧鎺夋墍鏈夌殑缃戠粶鎺ュ彛銆偮
聽聽
[-p] 璇ラ夐」涓虹己鐪侀夐」銆傚氨鏄叧鏈烘椂璋冪敤poweroff銆偮
聽聽
3.reboot聽
聽聽
reboot鐨勫伐浣滆繃绋嬪樊涓嶅璺焗alt涓鏍凤箰涓嶈繃瀹冩槸寮曞彂涓绘満閲嶅惎锕愯宧alt鏄叧鏈恒傚畠鐨勫弬鏁颁笌halt鐩稿樊涓嶅銆偮
聽聽
4.init聽
聽聽
init鏄墍鏈夎繘绋嬬殑绁栧厛锕愬畠鐨勮繘绋嬪彿濮嬬粓涓1锕愭墍浠ュ彂閫乀ERM淇″彿缁檌nit浼氱粓姝㈡墍鏈夌殑鐢ㄦ埛杩涚▼锕戝畧鎶よ繘绋嬬瓑銆俿hutdown 灏辨槸浣跨敤杩欑鏈哄埗銆俰nit瀹氫箟浜8涓繍琛岀骇鍒(runlevel)锛宨nit 0涓哄叧鏈猴箰init 1涓洪噸鍚傚叧浜巌nit鍙互闀跨瘒澶ц锕愯繖閲屽氨涓嶅啀鍙欒堪銆傚彟澶栬繕鏈塼elinit鍛戒护鍙互鏀瑰彉init鐨勮繍琛岀骇鍒箰姣斿锕恡elinit -iS鍙娇绯荤粺杩涘叆鍗曠敤鎴锋ā寮忥箰骞朵笖寰椾笉鍒颁娇鐢╯hutdown鏃剁殑淇℃伅鍜岀瓑寰呮椂闂淬

AWStats涓巆ronolog鍒嗘瀽apache鐨凩OG鏃ュ織(杞)

鍙傝冨涓汉鐨勬枃妗
http://bbs.chinaunix.net/viewthread.php?tid=613098
http://www.ieasy.org/coffee/archives/cat_technology_related.html

1.apache瀹夎

apache瀹夎

#wget聽http://archive.apache.org/dist/httpd/httpd-2.0.54.tar.gz
#tar xzvf聽httpd-2.0.54.tar.gz
#./configure –prefix=/usr/local/apache –with-mpm=worker –enable-so –enable-ssl –enable-mods-shared=all

2.cronolog 瀹夎,璇峰弬鑰冩垜鍐欑殑涓婁竴绡囨枃绔
http://blog.chinaunix.net/article.php?articleId=63868&blogId=2898

 

3.AWStats瀹夎
AWStats 瀹樻柟缃戠珯锛http://awstats.sourceforge.net/
涓嬭浇鏈鏂扮殑鐗堟湰
#鑰佺増鏈夋紡娲瀆-^
wget聽http://awstats.sourceforge.net/files/awstats-6.5.tar.gz
tar awstats-6.5.tar.gz
mv awstats-6.5 /usr/local/awstats
cd /usr/local/awstats/tools

4.閰嶇疆
#鐩存帴鍒嗘瀽 apache log 鐨 AWStats 璁惧畾鐨凩OG聽
#鐩存帴鍦ㄦ鐩綍鎵ц
perl awstats_configure.pl

 

QUOTE:

—– AWStats awstats_configure 1.0 (build 1.3) (c) Laurent Destailleur —–
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to ‘understand’ all possible ways to use AWStats…
Read the AWStats documentation (docs/index.html).聽
—–>; Running OS detected: Linux, BSD or Unix
—–>; Check for web server install聽

Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:Program filesapache groupapacheconfhttpd.conf
Config file path (‘none’ to skip web server setup):

>;/etc/httpd/conf/httpd.conf

#杈撳叆apache 鐨勯厤缃枃浠剁洰褰
—–>; Check and complete web server config file ‘/usr/local/apache

聽聽AWStats directives already present.聽

—–>; Update model config file ‘/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf’
聽聽File awstats.model.conf updated.聽

—–>; Need to create a new config file ?
Do you want me to build a new AWStats config/profile

file (required if first install) [y/N] ? y

#杈撳叆 y锛岀‘瀹氫骇鐢 AWStats閰嶇疆鏂囦欢

—–>; Define config file name to create

What is the name of your web site or profile analysis ?

Example: www.mysite.com
Example: demo

Your web site, virtual server or profile name:
>;聽www
#杈撳叆 www锛屼负閰嶇疆鏂囦欢鏈鍚嶅瓧锛屾鍙嚜鍙柭

—–>; Define config file path

In which directory do you plan to store your config file(s) ?

Default: /etc/awstats

Directory path to store config file(s) (Enter for default):

>;
#鐩存帴鎸変笅 Enter锛
—–>; Create config file ‘/etc/awstats/awstats.www.conf’

Config file /etc/awstats/awstats.www.conf created.聽

—–>; Restart Web server with ‘/sbin/service httpd restart’

鍋滄 httpd:聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽[聽聽纭畾聽聽]

鍚姩聽httpd:聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽[聽聽纭畾聽聽]
—->; Add update process inside a scheduler

Sorry, configure.pl does not support automatic add to cron yet.

You can do it manually by adding the following command to your cron:

/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www

Or if you have several config files and prefer having only one command:

/usr/local/awstats/tools/awstats_updateall.pl now

Press ENTER to continue…

#鎸変笅 Enter 缁х画,鎸変袱娆

chmod 755 /usr/local/awstats

mkdir /var/lib/awstats

#淇敼閰嶇疆鏂囦欢

cp /etc/awstats/awstats.www.conf /etc/awstats/awstats.www.conf.bak
#澶囦唤閰嶇疆鏂囦欢
vi /etc/awstats/awstats.www.conf

QUOTE:

51琛 LogFile=”/var/log/httpd/mylog.log” 淇敼鎴–>;聽/LogFile=”/usr/local/apache/logs/960it_access_log.%YYYY-24%MM-24%DD.log”
#淇敼浣犵殑LOG鏂囦欢鍙婄洰褰,閰嶅悎cronolog 鍜宑ron鍒嗘瀽褰撳ぉ鐨勬棩蹇
147琛 SiteDomain=”www” 淇敼鎴–>;聽SiteDomain=”浣犵殑鍩熷悕”

182琛 DNSLookup=2 淇敼鎴–>;聽DNSLookup=1

/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www -update

#涓婇潰涓鍙ヨ鐗瑰垾娉ㄦ剰,鍙版灉浣犵殑绯荤当鍏堝墠浜х敓澶ч噺澶ч噺鐨刲og,璇风瓑鍊!涓嶈鎸塩tal+c绲愭潫

#awstats榛樿浼氭妸绯荤粺榛樿瀹夎鐨刟pache鍚姩,濡傛灉浣犱笉鏄敤杩欎釜璇峰厛鎶婂仠姝.

/etc/rc.d/init.d/httpd聽stop

/usr/local/apache/bin/apachectl聽 restart
娴嬭瘯锛http://IP/awstats/awstats.pl?config=www

#瀹氭檪鏇存柊
crontab -uroot -e
#鍦ㄦ鏂囦欢鐨勬渶鍚庡鍔,璁剧疆鎴愭瘡澶╂櫄涓23:50鍒嗘瀽褰撳ぉ鐨凩OG

QUOTE:

50聽23 * * * root /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www -update >;/dev/null 2>;

5.瀹夊叏

淇濇姢/db/htdocs/www/awstat/绂佹鏈巿鏉冪敤鎴疯闂
淇敼
#vi /usr/local/apache/conf/httpd.conf

<Directory “/usr/local/awstats/wwwroot/www”>
聽聽 AuthType Basic
聽 AuthName “Restricted Files”
聽 AuthUserFile /usr/local/apache/passwd/passwords
聽 Require user loguser
</Directory>

鍏朵腑鍦 /usr/local/apache/passwd/涓嬩骇鐢焢asswords 鐨勫瘑鐮佹枃浠
杩愯濡備笅浠g爜浜х敓鐢ㄦ埛鍚嶄负loguser鐢ㄦ埛鍙婂叾瀵嗙爜

 

聽浠ヤ笂鐨勮缃敱浜庤cgi鏀寔锛屼篃澧炲姞浜嗗畨鍏ㄩ殣鎮e彲浠ョ敤awstats 鑷甫鐨刟wstats_buildstaticpages.pl鏉 鐢熸垚闈欐侀〉闈 鍙互娣诲姞鍒癱rontab涓

銆銆50 23 * * * * /usr/local/awstats/tools/awstats_buildstaticpages.pl -update -config=www. -lang=cn -dir=/db/htdocs/www/awstat/ -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl

銆銆濡傛灉www.abc.net聽铏氭嫙涓绘満 涓荤洰褰曚负/db/htdocs/www/ 鍒欏湪娴忚鍣ㄤ腑杈撳叆http://www.abc.net/awstat/awstats.www.abc.net.html聽灏卞彲浠ラ氳繃璁ょ湡璁块棶闈欐侀〉闈

6.澧炲姞涓璦wstats 鏄剧ず鏉ヨ鑰呬綅缃殑鎻掍欢 qqhostinfo

棣栧厛锛岀偣鍑杩欓噷涓嬭浇鎻掍欢銆傛妸瀹冩斁鍦╝wstats/wwwroot/cgi-bin/plugins涓

鍏舵,涓嬭浇涓婁竴绡嘼log鎻愬埌鐨鍒嗘瀽QQWry.dat鐨刾erl鑴氭湰

鐒跺悗鏀惧湪鍚屼竴鐩綍,鍘荤綉涓婁笅杞絈QWry.Dat鏀惧湪鍚屼竴鐩綍涓紝娉ㄦ剰鏂囦欢鍚嶄竴瀹氳鏄疩QWry.Dat,瀹為檯涓婃槸鎴戠敤鎴戠殑鐝婄憵鐗堟湰鐨凲Q鐨勮繖涓枃浠.

鍐嶇紪杈戜綘寰梐wstats閰嶇疆鏂囦欢锛屽ぇ姒傚湪LoadPlugin=”hostinfo”鐨勫悗闈㈠鍔犱竴琛
LoadPlugin=”qqhostinfo”
鏈鍚
聽vi /usr/local/awstats/wwwroot/cgi-bin/plugins/qqhostinfo.pm
绗17琛

require鐨勮矾寰勬敼

require “/usr/local/awstats/wwwroot/cgi-bin/plugins/qqwry.pl”;

RHEL5绯荤粺 apache-2.2.11 + php-5.2.8 + mysql-5.1.30(杞)

1銆傚畨瑁卆pache-2.2.11
./configure
make
make install

鐒跺悗鍦 ~/.bash_profile 鏂囦欢涓坊鍔
PATH=$PATHHOME/bin:/usr/local/apache2/bin
杩欐牱涓轰簡鏂逛究鍚敤銆佸叧闂璦pache

2銆傚畨瑁卪ysql(mysql-5.1.30-linux-i686-icc-glibc23.tar.gz)
杩欓噷閲囩敤鐨勬槸mysql鐨勪簩杩涘埗鐗堟湰(32浣)锛屽苟涓篒ntel鏋勬灦浼樺寲杩囩殑
鍙傝冿細[url]http://dev.mysql.com/doc/refman/5.1/en/installing-binary.html[/url]

銆愬娉ㄣ
鍒氬紑濮嬭繖涓増鏈湪 rhel5 涓婅繍琛 scripts/mysql_install_db –user=mysql 澶辫触
鏀圭敤鐗堟湰 mysql-5.0.67-linux-i686-icc-glibc23.tar.gz 瀹夎姝e父锛屽悗鏉ュ彂鐜板湪
/var/lib/mysql 鐩綍涓嬫湁浠ュ墠5.0鐗堟湰鐨勬暟鎹紝鍙兘鐢变簬鍏煎鎬у鑷5.1鐗堟湰瀹夎涓嶆甯革紝
浜庢槸鎴戝皢鍘熸潵鐨勬暟鎹垹闄ゅ嵆鍙甯稿畨瑁 5.1 鐗堟湰銆

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db –user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe –user=mysql &

——————————————————————————–

[root@miix mysql]# scripts/mysql_install_db –user=mysql
Installing MySQL system tables…
OK
Filling help tables…
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password ‘new-password’
./bin/mysqladmin -u root -h miix.hoho.com password ‘new-password’

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.聽 This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available at聽[url]http://www.mysql.com/[/url]
Support MySQL by buying support/licenses from聽[url]http://shop.mysql.com/[/url]
——————————————————————————–

瀹夎瀹屾瘯鍚庢牴鎹互涓婄殑鎻愮ず锛屽埆蹇樹簡璁剧疆mysql root鐢ㄦ埛瀵嗙爜锛屾垜鍙﹀鏂板缓涓涓敤鎴 zhaozh
mysql> grant all on *.* to聽zhaozh@localhost聽identified by ‘脳脳脳脳脳脳’

3銆傚畨瑁卲hp-5.2.8

./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/local/mysql –with-mysqli –with-gd –with-jpeg-dir –with-png-dir
make
make install

cp php.ini-dist /usr/local/lib/php.ini

php瀹夎瀹屽悗锛屽湪 /usr/local/apache2/modules 娣诲姞浜嗗姩鎬佽繛鎺ュ簱 libphp5.so

濡傛灉鍦ㄥ惎鍔ㄦ垨鑰呴噸鍚痑pache鏃跺欙紝鍑虹幇浠ヤ笅淇℃伅锛
[root@miix htdocs]# apachectl -k restart
httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied

杩欐槸鐢变簬selinux寮曡捣鐨勶紝鎵浠ラ渶瑕佽繖鏍蜂竴涓嬶細
chcon -t textrel_shlib_t libphp5.so

php瀹夎瀹屽悗锛屽湪 /usr/local/apache2/conf/httpd.conf 娣诲姞浜嗕竴琛岋細
LoadModule php5_module聽聽聽聽聽聽聽 modules/libphp5.so

鏈汉涓嶆兂閲囩敤杩欑鏂瑰紡锛屼簬鏄皢涓婅堪涓琛屾敞閲婃帀锛岀劧鍚庡湪 httpd.conf 鏂囦欢鏈熬娣诲姞锛
Include conf/conf.d/*.conf

鎺ョ潃寤虹珛鐩綍 /usr/local/apache2/conf/conf.d聽
娣诲姞 php.conf 鏂囦欢锛屽唴瀹瑰涓嬶細

——————————————————————————–
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

LoadModule php5_module modules/libphp5.so

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps

——————————————————————————–

閲嶅惎apache锛屽湪 /usr/local/apache2/htdocs 鐩綍涓嬪缓绔嬩竴涓 test.php 鏂囦欢锛屽涓
<?php phpinfo(); ?>

鍦ㄦ祻瑙堝櫒杈撳叆聽[url]http://ip/test.php[/url]聽锛屽鏋滆兘姝e父鏄剧ず鍑簆hp淇℃伅鍒欒鏄巃pache+php OK浜嗐

——————————————————————————————

璧靛皬铚楃墰

QQ:聽755721501

E-mail:聽snailwarrior@qq.com

鍦ㄤ笉鏂鐚腑璋嬫眰鐢熷瓨鍙戝睍銆佹墦閫犺嚜宸辩殑浼樼鍝佽川锛岀敤浜烘ф渶鏈川鏈鍔ㄤ汉鐨勪竴闈⑩滆惀閿鈥濊嚜宸!

鏈枃鍑鸿嚜 鈥灏忚湕鐗涙妧鏈箣瀹鈥 鍗氬锛岃鍔″繀淇濈暀姝ゅ嚭澶http://snailwarrior.blog.51cto.com/680306/137690