PHP shared memory segment example sharing_PHP tutorial

WBOY
Release: 2016-07-13 10:40:25
Original
936 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...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template