给 PHP 开启 shmop 扩展实现共享内存-php教程

资源魔 31 0
正在名目开发中,想要完成PHP多个过程之间同享数据的性能,让客户端衔接可以同享一个状态,需求开启同享内存函数shmop。假如预期思考会遇到这方面需要,那末最佳正在编译PHP的时分增加--with-shmop选项。然而编译的时分不增加,只能正在从新编译设置装备摆设了。

1、找到php源码包里的扩大目次,进入shmop

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

2、执行phpize,天生设置装备摆设

# 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、执行饬令开端编译

# ./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、修正php.ini开启扩大

复制前往的那行门路:/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/

# vim /usr/local/php/etc/php.ini
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/shmop.so   //增加此行代码,前面跟上shmop.so

重启php

897efc0e88502cbf30b629c6a706fb7.png

以上就是给 PHP 开启 shmop 扩大完成同享内存的具体内容,更多请存眷资源魔其它相干文章!

标签: php php开发教程 php开发资料 php开发自学

抱歉,评论功能暂时关闭!