wget -c http://soft.vpser.net/web/php/php-5.2.17.tar.gz wget -c http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz tar zxvf php-5.2.17.tar.gz gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1 cd php-5.2.17/ wget -c http://soft.vpser.net/web/php/bug/php-5.2.17-max-input-vars.patch patch -p1 < php-5.2.17-max-input-vars.patch /home/web/php/bin/php -i |grep configure ./configure –xxxxx //按自己原始配置即可 这里就不详细一一罗列了 防跨站:
/* {{{ php_check_open_basedir
*/
PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC)
{
/* Only check when open_basedir is available */
if (PG(open_basedir) && *PG(open_basedir)) {
char *pathbuf;
char *ptr;
char *end;// 添加的内容开始
char *env_document_root = sapi_getenv(“DOCUMENT_ROOT”, sizeof(“DOCUMENT_ROOT”)-1 TSRMLS_CC);
if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) {
efree(env_document_root);
return 0;
}
// 添加的内容结束
*/
PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC)
{
/* Only check when open_basedir is available */
if (PG(open_basedir) && *PG(open_basedir)) {
char *pathbuf;
char *ptr;
char *end;// 添加的内容开始
char *env_document_root = sapi_getenv(“DOCUMENT_ROOT”, sizeof(“DOCUMENT_ROOT”)-1 TSRMLS_CC);
if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) {
efree(env_document_root);
return 0;
}
// 添加的内容结束
pathbuf = estrdup(PG(open_basedir));
ptr = pathbuf;
while (ptr && *ptr) {
end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
if (end != NULL) {
*end = ‘\0’;
end++;
}
if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) {
efree(pathbuf);
return 0;
}
ptr = end;
}
if (warn) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, “open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)”, path, PG(open_basedir));
}
efree(pathbuf);
errno = EPERM; /* we deny permission to open it */
return -1;
}
/* Nothing to check… */
return 0;
}
保存退出后再编译安装
make && make install //重新编译 zijidelu可以直接配置以下参数: php.ini中的open_basedir改为:open_basedir = "/home/ftp/1520/:/var/tmp/:/tmp/" 注意:如果是apache nginx lighttpd 都要停止php服务在进行重新编译
然后按原来的编译再编译下即可。再重启下cgi服务