Posts Tagged ‘php’

cherokee下设置local与remote方式的php fastcgi

01.04.2009 by admin - 0 Comment
Posted in cherokee web server, linux, php

分类:cherokee web server分类:php还是先假设一下服务器环境:
cherokee的ip地址是:172.16.236.191
cherokee安装在/usr/local/cherokee
php安装在/usr/local/php5,编译了fastcgi支持

与zeus、lighttpd一样,cherokee支持将php作为本地的fastcgi解释器运行,也支持将php作为Remote方式运行。
默认情况下,cherokee选择Local interpreter作为php的运行方式,并且已经附送了一个默认的php配置,如果你的php可执行文件位于PATH环境变量内,你甚至都不用做任何配置就可以直接使用。
下面我们来看看第一种情况如何进行配置:

点击左侧导航栏的“Information Sources”,在右侧“Known sources”下面列出了目前已知的信息源,点击默认的“php”,进入php设置:
Read the rest of this entry »

cherokee牛刀小试

12.18.2008 by admin - 0 Comment
Posted in linux

cherokee-logo
习惯了Apache、lighttpd、nginx,不知道你用过cherokee这个web服务器没。“cherokee比nginx还快”,相信这个理由足够让你来尝试一下这个目前号称最快的web服务器。经过一番尝试,发现cherokee还有一个很爽的功能:图形化的web管理界面(类似zeus的管理界面),怎么样,心动了吧。

cherokee的官方网址是:http://www.cherokee-project.com,你可以从这里下载到最新的源代码,找到它详细的说明文档。

下面这段文字简单翻译自官方的说明文档(英文很烂,见笑了)

cherokee是一个高效的、轻量级的、高稳定性的、容易配置的web服务器 …
cherokee支持很多技术:FastCGI , SCGI , PHP, CGI , X-Sendfile , TLS , SSL …
cherokee支持虚拟主机、权限认证、负载均衡 …
cherokee的日志格式与apache是兼容的 …
cherokee可以在不中断服务的前提下进行升级更新(nginx也有这个功能)…

Read the rest of this entry »

Wordpress2.7又跳票了

12.05.2008 by admin - 0 Comment
Posted in php

分类:php本来以为今天能发布了,唉,再等等吧…

php5.2.7发布了,修复了大量bug,不过我还得等suhosin和fpm,只有再熬一会了…

php5.3 alpha3发布了,离正式版越来越近了…

两个PHP冷门函数的简要使用

11.14.2008 by admin - 2 Comments
Posted in php

分类:php相信你在使用Google或者Baidu搜索的时候,肯定碰到过他们的关键词提示。比如下面这个图:

对于搜索引擎来说,他们有一整套分词技术及完整的词库。而对于一般简单的PHP应用来说,做到这种完善的分词又是很困难的。
其实php中有两个函数,可以近似的完成这样的功能。

这两个函数就是:levenshtein 和 similar_text
以下分别是这两个函数的官方解释:
http://www.php.net/manual/en/function.levenshtein.php
http://www.php.net/manual/en/function.similar-text.php

我们来简单看一下使用这两个函数的效果。

Read the rest of this entry »

Windows下同时安装Zend Optimizer和Zend Debugger

11.05.2008 by admin - 0 Comment
Posted in php

分类:php很多人都说不可以,研究了一下,发现还是可以的。

先安装Zend Optimizer,这个很简单,大家都会了。然后到Zend网站下载最新的Zend Debugger的windows版本。
做一些假设:

Read the rest of this entry »

使用php-fpm来平滑变更FastCGI模式下的php设置

10.16.2008 by admin - 0 Comment
Posted in linux

在使用FastCGI方式运行php的时候,如果我们改变了php.ini的设置,就得重新启动php的fastcgi守护程序。如果你的系统负载比较大的话,这个重启过程或许会让你的系统中断服务一段时间。php-fpm就是为了解决这个问题而诞生的,它可以在php的fastcgi进程不中断的情况下重新加载你改动过的php.ini。
而且php-fpm可以不用再依赖其它的fastcgi启动器,比如lighttpd的spawn-fcgi,对于我来说终于可以摆脱lighttpd的影子了。

还等什么,开始吧!

我的php版本是5.2.6,先到官网下载与php版本对应的php-fpm补丁:PHP-FPM

假设:php源代码目录在:/usr/local/src/php-5.2.6,php-fpm下载到了/usr/local/src

  1. cd /usr/local/src
  2. gzip -cd php-5.2.6-fpm-0.5.9.diff.gz | patch -d php-5.2.6 -p1

Read the rest of this entry »

Cacti安装笔记

10.14.2008 by admin - 2 Comments
Posted in linux

cacti是一套PHP程序,它运用snmpget采集数据,使用rrdtool绘图。使用Cacti能统计网络设备的流量、CPU、系统负载等参数,也可以自定义监测的指标。

服务器是CentOS 5.2,内核已经升级到最新的2.6.27,使用yum安装了gcc、libtool、gd-devel等软件,然后自行编译安装了Lighttpd、PHP(FastCGI)、MySQL。
开始之前,最好装一下yum的fastestmirror插件,这样yum安装软件的时候一般会快一些。

  1. yum install yum-fastestmirror -y

Read the rest of this entry »

给你的PHP打上Suhosin补丁

10.13.2008 by admin - 0 Comment
Posted in linux

Suhosin:朝鲜文意为“守护神”。

如果你用过FreeBSD的ports安装了php5,那Suhosin这个玩意你可能已经听说过了。
大致翻了翻它的官方网站,Suhosin至少能做这些事情:

  • 保护你的服务器,以免被某些不健壮的php代码/源码所伤害
  • 在php的内核级(Zend Engine Protection)保护你的服务器,避免诸如内存泄露之类的黑客行为
  • 彻底解决php的“远程文件包含”带来的安全隐患
  • 可使用额外的配置来禁止一些php中可能带来安全隐患的功能,如eval函数,preg_replace的/e修饰符

英文好的话,可以到官网去看更多的介绍。既然FreeBSD的ports都选用了Suhosin,应该错不了的,下面还是开始安装了吧。

Read the rest of this entry »

ZendDebugger在Linux下的某个错误

10.06.2008 by admin - 0 Comment
Posted in 未分类

CentOS,PHP-Fastcgi,XCache, 局域网内的测试服务器。
由于要调试PHP程序,所以在服务器上安装了ZendDebugger以便和电脑上的ZendStudio联合进行调试,可是按照以往的配置经验,在php.ini中加入类似如下配置:

  1. zend_extension=/full/path/to/ZendDebugger.so
  2. zend_debugger.allow_hosts=<ip_addresses>
  3. zend_debugger.expose_remotely=always

然而重启phpfastcgi进程以后,php程序却报这个错误:

  1. Debugger compile handler overriden, cannot continue

Read the rest of this entry »

让人兴奋的PHP5.3开始alpha了

08.18.2008 by admin - 0 Comment
Posted in 未分类

Namespace这个东西终于要正式加入PHP了

以下官方的申明:

[01-Aug-2008]
The PHP development team is proud to announce the first alpha release of the upcoming minor version update of PHP. Windows binaries will be available starting with alpha2 (intermediate snapshots available at snaps.php.net). The new version PHP 5.3 is expected to improve stability and performance as well as add new language syntax and extensions. Several new features have already been documented in the official documentation, others are listed on the wiki in preparation of getting documented. Please also review the NEWS file.