Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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 ÖÆ×÷ͨѶ¼£¨ËÄ£©

Õâ´ÎÎÒÃǽ²ÈçºÎÓÃPHP´´½¨Êý¾Ý¿âÒÔ¼°±í£¬ºÍ±£´æÏà¹ØÅäÖÃ
ÏÈ´´½¨Ò»¸öÒ³Ãæ£¬ÓÃÀ´ÊäÈëÏà¹ØÐÅÏ¢
±íµ¥¶¯×÷Ϊ CreateData.php £¬±£´æÎªInstall.html (ÒòΪûÓÐÓõ½PHP£¬ËùÒÔ¿ÉÒÔ±£´æÎªHTML¸ñʽ)
È»ºó´´½¨Ò»¸öPHPÎļþ£¬±£´æÎªCreateData.php £¬ÓÃÀ´´´½¨Êý¾Ý¿âºÍ±£´æÏà¹ØÐÅÏ¢
<?php
if(file_exists("Config.php"))
......

UbuntuÏÂÅäÖÃLAMP£¨Linux+Apache+Mysql+PHP)»·¾³

ÖÕÓڷżÙÁË£¬ÕýÏëÔÚÕâ¸ö¼ÙÆÚÀïѧѧPHP£¬ÓÉÓÚ×Ô¼ºÓõÄÊÇ×ÀÃæ°æµÄUbuntu8.04,ÓÚÊǾÍÏë¼ÜÉèÒ»¸öLAMP»·¾³À´Ñ§PHP£¬Ò²³Ã´Ë»ú»áѧһÏÂPHP·þÎñÆ÷µÄ¼ÜÉè¡£
Ò»¡¢°²×°Ubuntu8.04
ËäȻ˵ÊÇÅäÖÃLAMP»·¾³£¬µ«ÔÚÎÄÕÂÀï²¢²»»á½²ÊöÈçºÎ°²×°Ubuntu8.04,ÒòΪ¹ØÓÚÈçºÎUbuntu8.04ÔÚÍøÉÏÒѾ­ÓкܶàµÄ½Ì³ÌÁË£¬¾ÍËãÊÇÓ²Å̰²×°Ò²ÊÇÒ»¼þºÜ¼òµ¥µÄÊÂÁ ......

php·ÖÒ³Ô­Àí

<?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=$_ ......

phpÌáÈ¡ÍøÒ³url


//»ñÈ¡ url
function match_links($document) {
preg_match_all("'<\s*a\s.*?href\s*=\s*([\"\'])?(?(1)(.*?)\\1|([^\s\>]+))[^>]*>?(.*?)</a>'isx",$document,$links);
while(list($key,$val) = each($links[2])) {
if(!empty($val))
$match[] = $val;
}
......

PHPµÄTokyoTyrantÀ©Õ¹½Ó¿ÚAPIÎĵµ(PECL)

ÊÖ²áµÄ¹Ù·½µØÖ·: http://us3.php.net/manual/en/book.tokyo-tyrant.php
¾ßÌåÄÚÈÝÈçÏÂ:
TCTÖ§³ÖµÄ×·¼Ó²ÎÊý:
mode:
bnum: ͰÊý×éÔªËØ¸öÊý,Èç¹û²»´óÓÚ0,ʹÓÃĬÈÏÖµ, ĬÈÏÖµÊÇ131071, ½¨ÒéÖµÊÇËùÓд洢µÄ¼Ç¼ÌõÊýµÄ0.5-4±¶.
apow: ºÍÒ»¸ökey¹ØÁªµÄ¼Ç¼Êý,Èç¹ûÊǸºÖµ, ʹÓÃĬÈÏÖµ, ĬÈÏֵΪ4, ÒâΪ2µÄ4´Î·½.
fpow: FreeBl ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ