2013-05-01
2013-04-13
CODE - 執行 php 出現的 Host key verification failed. 255 / Host key verification failed
php code
會顯示
Host key verification failed. 255 / Host key verification failed.
(或用 exec , retval 是 255 的情況)
解決方法 :
由執行 php code 的機器(這裡是 stage), 用 wwwrun 的身份去 ssh 該主機, 按 yes 即可
大概是因為 vm clone 好後, 雖 stage 的 public key 已加在該主機的 authorized_keys2 裡,
但實際上卻未曾連過, 只要連過 public key 便可在 authorized_keys2 裡生效
$cmd = '/usr/bin/ssh root@x.x.x.x cat /home/logs/consumer.log 2>&1'; $last_line = system($cmd, $retval); echo json_encode($retval).' / '.$last_line;
會顯示
Host key verification failed. 255 / Host key verification failed.
(或用 exec , retval 是 255 的情況)
解決方法 :
由執行 php code 的機器(這裡是 stage), 用 wwwrun 的身份去 ssh 該主機, 按 yes 即可
大概是因為 vm clone 好後, 雖 stage 的 public key 已加在該主機的 authorized_keys2 裡,
但實際上卻未曾連過, 只要連過 public key 便可在 authorized_keys2 裡生效
2013-03-28
2013-03-27
2013-03-15
2013-01-07
2012-10-13
CODE - php 字串取代
example :
$path = '/home/nas/webhd_14/e2/c3/10107664/50012/sync/a3/string'; $path = preg_replace('/home\/nas/', 'net', $path); # output: /net/webhd_14/e2/c3/10107664/50012/sync/a3/string
$str = 'hello.@.@world'; $key = preg_replace(array('/\./', '/\@/'), '_', $str); # output: hello||||world
2012-08-22
2012-08-20
2012-08-18
2012-07-23
CODE - php xml to array
code as below
cf : http://jaspreetchahal.org/php-xml-to-array-simplest-way/
//$xml = implode('', $output); $xmlObj = simplexml_load_string($xml); $json = json_encode($xmlObj); $arr = json_decode($json, true); print_r($arr);
cf : http://jaspreetchahal.org/php-xml-to-array-simplest-way/
2012-07-06
2012-04-23
2012-03-15
2012-03-14
2012-03-05
2012-03-03
訂閱:
文章 (Atom)