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
$im = imagecreatefromjpeg("ok.jpg");
$black = @imagecolorallocate($im, 0,0,0);
$jpgnumid = "ÕâÊÇǶÈ뵽ͼƬµÄÎÄ×Ö£¬½â¾öÁËÂÒÂëÎÊÌâ,
ÉÏÃæµÄok.jpgÊÇͬĿ¼ÏµÄÕÕÆ¬.ʹÓÃËüʱ£¬»¹ÐèÒªÓÐiconv
Ä£¿é£¡Ò²¾ÍÊÇ˵ÔÚphp.iniÀォ
[iconv]
iconv.input_encoding = ISO-8859-1
iconv.internal_encodin ......
ÖÕÓڷżÙÁË£¬ÕýÏëÔÚÕâ¸ö¼ÙÆÚÀïѧѧPHP£¬ÓÉÓÚ×Ô¼ºÓõÄÊÇ×ÀÃæ°æµÄUbuntu8.04,ÓÚÊǾÍÏë¼ÜÉèÒ»¸öLAMP»·¾³À´Ñ§PHP£¬Ò²³Ã´Ë»ú»áѧһÏÂPHP·þÎñÆ÷µÄ¼ÜÉè¡£
Ò»¡¢°²×°Ubuntu8.04
ËäȻ˵ÊÇÅäÖÃLAMP»·¾³£¬µ«ÔÚÎÄÕÂÀï²¢²»»á½²ÊöÈçºÎ°²×°Ubuntu8.04,ÒòΪ¹ØÓÚÈçºÎUbuntu8.04ÔÚÍøÉÏÒѾÓкܶàµÄ½Ì³ÌÁË£¬¾ÍËãÊÇÓ²Å̰²×°Ò²ÊÇÒ»¼þºÜ¼òµ¥µÄÊÂÁ ......
<?php
$zip_filename = "testpm.zip";
$zip_filename = key_exists('zip', $_GET) && $_GET['zip']?$_GET['zip']:$zip_filename;
$zip_filepath = str_replace('\\', '/', dirname(__FILE__)) . '/' . $zip_filename;
if(!is_file($zip_filepath))
{
die('Îļþ"'.$zip_ ......
¼¶±ð£º Öм¶
Jack D Herrington
(jherr@pobox.com
), ¸ß¼¶Èí¼þ¹¤³Ìʦ, Leverage Software Inc.
2006 Äê 10 ÔÂ 19 ÈÕ
Éè¼ÆÄ£Ê½Ö»ÊÇΪ Java™ ¼Ü¹¹Ê¦×¼±¸µÄ —— ÖÁÉÙÄú¿ÉÄÜÒ»Ö±ÕâÑùÈÏΪ¡£Êµ¼ÊÉÏ£¬Éè¼ÆÄ£Ê½¶ÔÓÚÿ¸öÈ˶¼·Ç³£ÓÐÓá£Èç¹ûÕâЩ¹¤¾ß²»ÊÇ “¼Ü¹¹Ì«¿ÕÈË” µÄרÀû£¬ÄÇôËüÃÇÓÖÊÇʲ ......
ÊÖ²áµÄ¹Ù·½µØÖ·: 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 ......