Warning: curl_exec() has been disabled for security reasons in /pub/host/sunboyu/sunboyu/www/wp-includes/http.php on line 1022
2008 五月 24 一个程序猿 孙小一,孙小二,PHP,MYSQL,LINUX,APACHE,原创技术,扯淡

PHP SHELL,用php来代替bash

作者 : admin 于 2008年05月24日, 23:50:51
2008
05-24

总看到招聘php程序员的帖子说要求php程序员熟练运用linux,shell,我估计熟悉LAMP配置,在这个架构下开发php的人不在少数,但说到SHELL,估计有一批人一冒一身的冷汗。
c shell,bash shell的确用的少,但php shell你说不懂,就该左右开弓一百八十个大嘴巴。
php本身就是一种shell,在php4之后,php编译有个 –enable-cli 参数,php5之后这个参数几乎成了标配参数。php一样可以作为shell脚本运行在装有php环境的服务器上。
而在phpchina.com phpx.com总多bbs的招聘上,居然没有哪个php程序员拿出php shell这个技能去跟他们交涉。而实际上,phpshell的功能根本不比bash弱,而且在LAMP环境中,php shell比bashshell有诸多的优点。

下边是我在与非门科技工作时候的几个php shell应用,抛砖引玉,希望大家能学会这些简单但又适用的技能。

$root = “/var/www/”;
$bakdir = “/var/wwwbak/”.date(”Y-m-d”);
$dir = array(”***.eefocus.com”,”***.eefocus.com”);
if(!is_dir($bakdir)){
mkdir($bakdir);
}
foreach($dir as $key=>$value)
{
exec(”tar zcf “.$bakdir.”/”.$value.”.tar.gz /var/www/”.$value);
#echo “tar zcf “.$bakdir.”/”.$value.”.tar.gz /var/www/”.$value.”
“;
}
?>

这是一个简单的网站目录备份程序,使用cron每天执行,自动tar压包备份网站。虽然很笨的方法,但网站安全系数提高了,这个过程也不用写啥bash去解决。

其实在php执行shell的时候,已经支持命令行参数了,这些应用下次分解。

参考网站:

http://www.phpbuilder.com/columns/darrell20000319.php3

http://www.php-cli.com/

linux下安装eAccelerator加速器

作者 : admin 于 2008年05月24日, 23:16:48
2008
05-24

http://eaccelerator.net/ 官方

http://eaccelerator.net/wiki/Release-0.9.5.3 下载最新版本即可

安装前需要安装gcc或者phpize

然后安装php-devel yum install php-devel

./configure –enable-eaccelerator=shared-memory –with-php-config=/usr/bin/php-config –with-eaccelerator-shared-memory –with-eaccelerator-content-caching
make

注:–with-php-config 后边跟php-config的路径,根据环境确定

然后在php.ini中追加以下代码

安装为 Zend extension 模式:

zend_extension=”eaccelerator.so” //eaccelerator.so 拷贝到 php ext 目录下
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.log_file = “/log/httpd/eaccelerator_log”
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

如果你使用了thread safe模式安装的PHP,你必须使用 “zend_extension_ts” 替换第一行的 “zend_extension”.
安装为 PHP extension 模式:(这是大部分采用的方式)

extension=”eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.log_file = “/log/httpd/eaccelerator_log”
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

php ini 设置的详细文档 http://eaccelerator.net/wiki/Settings
api 文档 http://bart.eaccelerator.net/doc/phpdoc/

北漂简易西餐制作教程

作者 : admin 于 2008年05月24日, 21:17:28
2008
05-24

准备工作

汉堡坯子,沙拉酱,生菜,鸡蛋,火腿

蛋要用纯正的土鸡蛋,微火煎到6分熟

汉堡出炉

开吃!

卡巴又封key了

作者 : admin 于 2008年05月24日, 12:52:37
2008
05-24

那个用到2010年的key又完蛋了,这次有下载了一大堆的key,先破解卡巴本身,然后找了个key,Kaspersky Anti-Virus 6.0 Chinese Edition—-2008-1-23-0020EBC8.key ,居然可以,支持到2027年。暂时用一段吧。等发了工资买套正版去。