Home >Backend Development >PHP Tutorial >How to enable shmop extension for PHP to realize shared memory

How to enable shmop extension for PHP to realize shared memory

藏色散人
藏色散人forward
2021-03-04 11:28:092890browse

Enable shmop extension for PHP to realize shared memory

In project development, I want to realize sharing between multiple PHP processes The data function allows client connections to share a state, and the shared memory function shmop needs to be enabled. If you anticipate encountering this need, it is best to add the --with-shmop option when compiling PHP. However, it was not added during compilation and can only be configured after recompiling.

1. Find the extension directory in the php source code package and enter shmop

# cd /usr/local/src/php-7.1.10/ext/shmop/

2. Execute phpize to generate the configuration

# phpize
[root@bogon shmop]# ls
acinclude.m4    build         config.h.in  config.nice    configure     CREDITS     libtool    Makefile.fragments  missing        package2.xml  README         shmop.la
aclocal.m4      config.guess  config.log   config.status  configure.in  include     ltmain.sh  Makefile.global     mkinstalldirs  package.xml   run-tests.php  shmop.lo
autom4te.cache  config.h      config.m4    config.sub     config.w32    install-sh  Makefile   Makefile.objects    modules        php_shmop.h   shmop.c        tests

3. Execute the command to start compilation

# ./configure --with-php-config=/usr/local/php/bin/php-config
# make && make install
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/

4. Modify php.ini to enable the extension

Copy the returned line path:/usr /local/php/lib/php/extensions/no-debug-non-zts-20160303/

# vim /usr/local/php/etc/php.ini
rrree

Restart php

How to enable shmop extension for PHP to realize shared memory

## Recommended: PHP video tutorial

The above is the detailed content of How to enable shmop extension for PHP to realize shared memory. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete