ÓÃSSHÓëPHPÏàÁ¬½Ó,È·±£Êý¾Ý´«ÊäµÄ°²È«ÐÔ
ÓÃSSHÓëPHPÏàÁ¬½Ó,È·±£Êý¾Ý´«ÊäµÄ°²È«ÐÔ
SSH¿ÉÒÔͨ¹ý½«Áª»úµÄ·â°ü¼ÓÃܵļ¼Êõ½øÐÐ×ÊÁϵĴ«µÝ; ʹÓÃSSH¿ÉÒÔ°Ñ´«ÊäµÄËùÓÐÊý¾Ý½øÐмÓÃÜ£¬¼´Ê¹ÓÐÈ˽ػñµ½Êý¾ÝÒ²ÎÞ·¨µÃµ½ÓÐÓõÄÐÅÏ¢¡£Í¬Ê±Êý¾Ý¾¹ýѹËõ£¬´ó´óµØ¼Ó¿ìÁË´«ÊäµÄËٶȡ£×ÜÖ®£¬Í¨¹ýSSHµÄʹÓ㬿ÉÒÔÈ·±£×ÊÁÏ´«Êä±È½Ï°²È«²¢ÇÒ´«ÊäЧÂʽϸߡ£
²»¹ý£¬²¢·ÇËùÓÐÈËÖªµÀPHP¿ÉÒÔÓëSSHÁ¬½ÓµÄÌØÐÔÒÔ¼°ÓëÖ´ÐÐÔ¶³ÌÃüÁîµÄÄÜÁ¦£¬²»¹ýÕâ·½ÃæÈ´·Ç³£ÓÐÓá£ÓÉÓÚÎÒÃÇ¿ÉÒÔÔںܶ಻ͬµÄ·½ÃæÀûÓÃPHP£¬Òò´ËËüÓкܶàÉèÖÃÑ¡ÏîÀ´¿ØÖÆÆäÐÐΪ¡£Ò»×éÅÓ´óµÄ¿ÉÑ¡²ÎÊýÄܹ»±£Ö¤Äú¿ÉÒÔ½« PHP ÓÃÓÚÐí¶à²»Í¬µÄÄ¿µÄ£¬µ«ÕâͬʱҲÒâζ×ÅÕâЩ²ÎÊýºÍ·þÎñ¶ËÅäÖõÄ×éºÏ»á´øÀ´Ò»Ð©°²È«ÎÊÌâ¡£±ÊÕßÒ»Ö±ÔÚPHP CLIÓ¦ÓóÌÐòÖÐʹÓÃSSH£¬±ÊÕßÊÇ´ÓcronjobsÖÐʹÓÃËüµÄ£¬²»¹ýÒ»¿ªÊ¼²¢·ÇÊ®·Ö¼òµ¥£¬¿ÉÒÔ˵ÆÄ·ÑÖÜÕÛ¡£¹ØÓÚ°²È«Ê¹ÓÃShell2 º¯ÊýµÄÊÖ²áÒ²²»ÊÇÊ®·ÖʵÓ㬱ÊÕß½øÐÐÁ˶à´ÎÊÔÑéÖ®ºó²ÅÓÐÁ˽ñÌìÕâƪСÎÄÕ£¬Ô¸Äú¶ÁÁËÖ®ºóÄÜΪÄúÅäÖÃPHP½ÚÊ¡Ò»µã¶ùʱ¼ä¡£
ÔÚÕâƪÎÄÕÂÖУ¬±ÊÕßÐèÒª¼ÙÉ裺
ÄãÕýÔÚÔËÐеIJÙ×÷ϵͳÊÇDebian / Ubuntu¡£Èç¹ûÄãÔËÐеIJ»ÊÇDebian / Ubuntu£¬Äã¿ÉÄÜÐèÒªÓÃÄãµÄLinux·¢Ðа汾ÌṩµÄÊý¾Ý°ü¹ÜÀíÆ÷À´Ìæ»»±¾ÎĶÔÓ¦ÄÚÈÝ¡£
ÄãÔËÐеÄÊÇPHP5.Èç¹ûÄãÔËÐеIJ»ÊÇPHP5£¬¿ÉÓÃPHP4´úÌæÖ®¡£
Äã¶ÔPHPºÍ·þÎñÆ÷¹ÜÀíÓлù±¾µÄÁ˽⡣
ÄãÒѾ°²×°ÁËPHP¡£
ÏȾöÌõ¼þ
°²×°³ÌÐò°ü
Ê×ÏÈ£¬ÈÃÎÒÃÇ°²×°ÏÂÃæµÄ³ÌÐò°ü£º
sudo aptitude update
sudo aptitude install php5-dev php5-cli php-pear buid-essential \
openssl-dev zlib1g-dev
°²×°Íê³É½øÈëÏÂÒ»²½¡£
±àÒëlibssh2
ÔÚ´ÓsourceforgeÍøÕ¾ÏÂÔØÁËLibssh2Ö®ºó£¬ÎÒÃÇÐèÒª±àÒëËü£¬²»¹ý²»Òªµ£ÐÄ£¬ÄãÖ»ÐèÒª°´ÕÕÈçϵķ½·¨²Ù×÷£º
cd /usr/src
wget surfnet.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.14.tar.gz
tar -zxvf libssh2-0.14.tar.gz
cd libssh2-0.14/
¡£/configure
make all install
Èç¹ûÄãÏë¼ì²éÊÇ·ñÓÐÁËÒ»¸öа汾£¬¿ÉÒԲ鿴SF.NET.²»¹ý£¬0.14Õâ¸ö°æ±¾¾Í×ã¹»ÁË¡£
°²×°
°²×°ssh2.so
ÏÂÒ»²½£¬ÎÒÃÇÐèÒª½«libsshºÍ PHPrÁ´½ÓÆðÀ´¡£ÓÐÒ»¸öPECLÄ£¿é¿ÉÒÔÍê³ÉÕâ¸ö¹¦ÄÜ¡£ÎÒÃÇ¿ÉÒÔʹÓÃPEAR°²×°Ëü¡£
pear install -f ssh2
-f²ÎÊýÈ·±£SSH2±»°²×°£¬¼´Ê¹²¢Ã»ÓÐÒ»¸öÎȶ¨µÄÑ¡Ôñ¶ÔÏó¡£Ä㻹¿ÉÒÔʹÓÃÈçϵİüÃû³Æ£ºssh2-betaÀ´Ç¿ÐÐÔËÐС£
ÏÖÔÚÄãÐèҪȷ±£ÎÒÃÇÕâ¸öеÄSSH2.SOÄ£¿é±»PHP¼ÓÔØ¡£±à¼ÄãµÄphp.iniÎļþ£¨¶ÔÓÚCLIʵÓóÌÐò£º/etc/php5/cli/php.ini£¬¶ÔÓÚApacheʵÓóÌÐò£º/etc/php5/apache
Ïà¹ØÎĵµ£º
Ò»£º½á¹¹ºÍµ÷ÓÃ(ʵÀý»¯)£º
class className{} £¬µ÷Óãº$obj = new className();µ±ÀàÓй¹Ô캯Êýʱ£¬»¹Ó¦´«Èë²ÎÊý¡£Èç$obj = new className($v,$v2...);
¶þ£º¹¹Ô캯ÊýºÍÎö¹¹º¯Êý£º
1¡¢¹¹Ô캯ÊýÓÃÓÚ³õʼ»¯£ºÊ¹ÓÃ__construct()£¬¿É´ø²ÎÊý¡£
2¡¢µ«Îö¹¹º¯Êý²»ÄÜ´ø²ÎÊý£¨ÓÃÓÚÔÚÏúÈ¥Ò»¸öÀà֮ǰִÐÐһЩ²Ù×÷»ò¹¦ÄÜ£©¡£Îö¹¹º¯ÊýÓà ......
from£ºhttp://www.xland.com.cn/article/7/81/0804/28778.htm
±¾ÀàʵÏÖ£º
Êý¾Ý¿âÐÅÏ¢µ¼³ö£ºword£¬excel£¬json£¬xml£¬sql
Êý¾Ý¿â»Ö¸´£º´Ósql£¬´ÓÎļþ
¾ßÌåÓ÷¨:
Ê×ÏÈн¨²âÊÔÓÃÊý¾Ý¿âmytest£¬È»ºóÔÚÀïÃ潨Õűí
PHP´úÂë:
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
--
-- ±íµÄ½á¹¹ `test`
--
CREATE TABLE `test` (
`id ......
³õѧPHPµÄʱºò£¬ÎÒÃǾ³£±»PHPµÄ¾ø¶Ô·¾¶ºÍÏà¶Ô·¾¶ÅªµÄÔÎͷתÏò¡£Â·¾¶ÎÊÌâ¾³£µ¼ÖÂinclude¼°requireÃüÁî²»ÄܼÓÔص½Ö¸¶¨µÄÒ³
Ã棬´Ó¶øµ¼ÖÂWeb³ÌÐòÔËÐдíÎó¡£±¾ÎĽ«¸ú´ó¼ÒÒ»Æð̽ÌÖÒ»ÏÂPHP·¾¶ÎÊÌâµÄ³£Óýâ¾ö·½°¸¡£
ÏÂÃæÎÒÃÇÏÈ×öÒ»¸ö¸ö¼òµ¥µÄʾÀý:
ÉÏͼÊÇÒ»¸ö¼òµ¥WebÏîÄ¿µÄ½á¹¹Í¼,ÆäÖи÷ÎļþµÄ´úÂëÈçÏÂ: ......
phpÁ¬½Ómysql²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall to undefined function 'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã ......
ÓÉÓÚ¹«Ë¾ÏîÄ¿µÄÐèÒª£¬×î¾ÔÚÑо¿QuercusÒ»¸ö´¿javaµÄphpÒýÇæ¡£ÏîÄ¿ÕâÁ½¸öÐèÒª×öµÄ¾ÍÊǽ«¸ÃÒýÇæ²Ã¼ô£¬×öÒ»¸öÏà¶Ô°²È«µÄ°æ±¾£¬Ìṩ¸øISVʹÓã¬Í¬Ê±£¬ÔÚÒýÇæÖÐÌṩĬÈϵĽӿڹ©µ÷Óá£ËùÒÔÏÈÑо¿ÁËһϣ¬ÔÚQuercusÒýÇæµÄÖ§³ÖÏ£¬PHPÈçºÎÓëjava¼¯³É¡£
ÒÔÏÂÊÇѧϰµ½µÄ¼¸µã£º
1¡¢Èç¹ûʹÓà Resin-IoC/WebBeansÀ´×éÖ¯Ó¦Óõķþ ......