php扩展多进程共享内存
	
    
    
	步骤:
1.运行命令:./ext_skel --extname=sharemem
2.运行命令:./configure --with-php-config=/usr/local/lnmp/php/bin/php-config
3.make clean
make
make install
/usr/local/lnmp/php/sbin/php-fpm restart
/usr/local/lnmp/php/bin/php-cgi /data0/htdocs/blog/sharemem.php
代码如下:
1.config.m4
PHP_ARG_ENABLE(sharemem, whether to enable sharemem support,
Make sure that the comment is aligned:
[  --enable-sharemem           Enable sharemem support])
if test "$PHP_SHAREMEM" != "no"; then
  
  PHP_NEW_EXTENSION(sharemem, sharemem.c, $ext_shared)
fi
2.php_sharemem.h
#ifndef PHP_SHAREMEM_H
#define PHP_SHAREMEM_H
extern zend_module_entry sharemem_module_entry;
#define phpext_sharemem_ptr &sharemem_module_entry
#ifdef PHP_WIN32
#define PHP_SHAREMEM_API __declspec(dllexport)
#else
#define PHP_SHAREMEM_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
/*hanhhh*/
#include "sys/mman.h"
#include "fcntl.h"
#include "semaphore.h"
#define FILE_MODE   (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
/*hanhhh*/
typedef struct php_shared_mm {
  sem_t mutex;  /* the mutex: a Posix memory-based semaphore */
  int count;  /* and the counter */
} php_shared_mm;
PHP_MINFO_FUNCTION(sharemem);
PHP_FUNCTION(say8_count_add); /* For testing, remove later. */
PHP_FUNCTION(say8_count_dec); /* For testing, remove later. */
#endif /* PHP_SHAREMEM_H */
3.sharemem.c
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_sharemem.h"
zend_function_entry sharemem_functions[] = {
 PHP_FE(say8_count_add, NULL)  
 PHP_FE(say8_count_dec, NULL)  
 {NULL, NULL, NULL} /* Must be the last line in sharemem_functions[] */
};
/* }}} */
/* {{{ sharemem_module_entry
 */
zend_module_entry sharemem_module_entry = {
#if 
    
     
	
	
    
    
	相关文档:
        
    
    <?php
/*
 * 分页实现
 */
include("conn.php");
$pagesize=2;
$url=$_SERVER["REQUEST_URI"];
$url=parse_url($url);
$url=$url[path];
$numq=mysql_query("SELECT * from test"); 
$num=mysql_num_rows($numq);
if($_GET[page]){
    $pageval=$_ ......
	
    
        
    
    (1)
Warning: mysql_query() [function.mysql-query]: Access denied for user 
'ODBC'@'localhost' (using password: NO) in C:\Program Files\Apache 
Software Foundation\Apache2.2\htdocs\TM\conn\conn.php on line 32
Warning: mysql_query() [function.mysql-query]: A link to the server could 
not be est ......
	
    
        
    
     最近在折腾 PHP + MYSQL
 的编程。了解了一些 PHP SQL 注入攻击
的知识,于是写了这篇文章 http://www.xiaohui.com/weekly/20070314.htm,总结一下经验。在我看来,引发 SQL 注入攻击
的主要原因,是因为以下两点原因:
  1. php 配置文件 php.ini 中的 magic_quotes_gpc
 选项没有打开,被置为 off
  2. 开发 ......
	
    
        
    
    
级别: 中级
Jack D Herrington
 (jherr@pobox.com
), 高级软件工程师, Leverage Software Inc.
2006 年  10 月  19 日
设计模式只是为 Java™ 架构师准备的 —— 至少您可能一直这样认为。实际上,设计模式对于每个人都非常有用。如果这些工具不是 “架构太空人” 的专利,那么它们又是什 ......
	
    
        
    
    
原文
(英文)地址: 
http://www.phpit.net/article/using-curl-php
 版权声明:署名-非商业性使
用-禁止演绎 2.0
摘要:
在这篇文章中主要讲解
php_curl库的知识,并教你如何更好的使用php_curl。
简介
你可能在你的编写PHP脚
本代码中会遇到这样的问题:怎么样才能从其他站点获取内容呢?这里有几个解决方式 ......