php共享内存扩展,怎么给PHP开启shmop扩展实现共享内存
发布日期:2021-06-24 12:04:06 浏览次数:2 分类:技术文章

本文共 1381 字,大约阅读时间需要 4 分钟。

给PHP开启shmop扩展实现共享内存

在项目开发中,想要实现PHP多个进程之间共享数据的功能,让客户端连接能够共享一个状态,需要开启共享内存函数shmop。如果预期考虑会遇到这方面需求,那么最好在编译PHP的时候添加--with-shmop选项。但是编译的时候没有添加,只能在重新编译配置了。

一、找到php源码包里的扩展目录,进入shmop# cd /usr/local/src/php-7.1.10/ext/shmop/

二、执行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

三、执行命令开始编译# ./configure --with-php-config=/usr/local/php/bin/php-config

# make && make installSee 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/

四、修改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

db0fa607b947595b3e52e85d7771efa4.png推荐:PHP视频教程

转载地址:https://blog.csdn.net/weixin_32637935/article/details/116509166 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:linux中判断用户是否存在,linux 判断当前用户是否是root
下一篇:oracle表对象定义,Oracle学习笔记——获取对象的定义

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2024年04月02日 04时37分12秒