Home > Backend Development > PHP Tutorial > PHP shared memory segment example sharing_PHP tutorial

PHP shared memory segment example sharing_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:40:25
Original
995 people have browsed it


Need to install the extension shmop
Find the PHP installation source file directory

Copy the code The code is as follows:

# cd /usr/local/php-5.4.0/ext/shmop
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local /php/bin/php-config
# make && make install

Compilation and installation successful

PHP shared memory segment example sharing_PHP tutorial

Copy code The code is as follows:

# cd /usr/local/php/lib/php/extensions/no-debug -non-zts-20100525/
One more shmop.so
Add shmop.so in php.ini
extension=shmop.so
; Module Settings;
phpinfo() output


PHP shared memory segment example sharing_PHP tutorial
 

Write data

Copy code The code is as follows:

$shmid = shmop_open(864, 'c', 0755, 1024);
shmop_write($shmid, "Hello World!", 0);
phpinfo();
?>

Read data

Copy code The code is as follows:

$shmid = shmop_open(864, 'c', 0755, 1024);
shmop_write($shmid, "Hello World!", 0);
echo shmop_read($shmid, 0, 11);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/718630.htmlTechArticleYou need to install the extension shmop. Find the php installation source file directory and copy the code as follows: # cd /usr/local/php- 5.4.0/ext/shmop # /usr/local/php/bin/phpize # ./configure --with-php-config=/u...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template