为php提供ssh2的支持
原贴:http://www.haw-haw.org/node/150
用来在php程序里方便的连到远程主机
执行程序
并取回结果
首先,系统需要已经装有openssl和openssl-devel包
rpm -qa | grep openssl
然后,安装libssh2
当下来源代码后
./configure && make all install
再然后,安装PECL/ssh2
可以用命令pear install ssh2
(眼前可能只能用pear install ssh2-beta
)
或者是去PECL/ssh2
当下来源代码
然后
phpize && ./configure –with-ssh2 && make
再然后把生成的ssh2.so
文件拷贝到php.ini
中申明的extension_dir
目录下(这里是/usr/lib/php4)
cp modules/ssh2.so /usr/lib/php4/
再在/etc/php.d目录下新建一个文件ssh2.ini
echo "extension=ssh2.so" > /etc/php.d/ssh2.ini
再重起web server,让其重读php.ini
搞定
原创文章,转载请注明:
转载自嘻嘻哈哈的部落格(blog)
本文链接地址:
为php提供ssh2的支持
相关文档:
PHP4:
<?
$sample1 = new StdClass();
$sample1->name = "Hasin";
$sample2 = $sample1;
$sample2->name = "Afif";
echo $sample1->name;
?>
In PHP4 it works differently; it will output Hasin, as both are different from
each other.
PHP5:
<?
$sample1 = new StdClass();
$ ......
你不必严格遵守这些原则,违背它们也不会被处以宗教刑罚。但你应当把这些原则看成警铃,若违背了其中的一条,那么警铃就会响起 。 ----- Arthur J.Riel
(1)所有数据都应该隐藏在所在的类的内部。
(2)类的使用者必须依赖类的共有接口,但类不能依赖它的使用者。
(3)尽量减少类的协议中的 ......
PHP函数按引用传递的例子
首先让我们来看一段代码如下:
<?php
$cost=20.99;
$tax=0.75;
function calculateCost(&$cost,$tax){
$cost=$cost+($cost*$tax);
$tax+=4;
}
calculateCost($cost,$tax);
printf("Tax is:%1.2f<br />",$tax);
  ......
环境:在linux 系统下安装好PHP+mysql +apache环境发现PHP没有支持pdo_mysql扩展于是决定重新编译PHP,其中mysql采用rpm方式安装
尝试:./configure --with-apxs2=/usr/local/apache/bin/apxs --with-iconv --with-oci8=instantclient,/usr /lib/oracle/10.2.0.1/client/lib --with-mysql=/usr/local/mys ......