duandong2562 2017-11-02 01:17
浏览 45

通过禁用模块可以提高PHP性能吗?

I'm running PHP 7.1.10 with Apache 2.4.6. There's a bunch of PHP modules that are probably not used in my application. Is there any performance boost disabling them?

# ls /etc/php.d
10-opcache.ini   20-dom.ini       20-gettext.ini  20-mbstring.ini  20-shmop.ini      20-sysvsem.ini    20-xsl.ini         30-wddx.ini
20-bz2.ini       20-exif.ini      20-gmp.ini      20-mysqlnd.ini   20-simplexml.ini  20-sysvshm.ini    20-zip.ini         30-xmlreader.ini
20-calendar.ini  20-fileinfo.ini  20-iconv.ini    20-pdo.ini       20-sockets.ini    20-tokenizer.ini  30-mysqli.ini      opcache-default.blacklist
20-ctype.ini     20-ftp.ini       20-imap.ini     20-phar.ini      20-sqlite3.ini    20-xml.ini        30-pdo_mysql.ini
20-curl.ini      20-gd.ini        20-json.ini     20-posix.ini     20-sysvmsg.ini    20-xmlwriter.ini  30-pdo_sqlite.ini

Example, 20-posix.ini:

# cat /etc/php.d/20-posix.ini
; Enable posix extension module
extension=posix.so

Can I safely disable most modules, or is there no significant performance boost?

  • 写回答

1条回答 默认 最新

  • doubo6658 2017-11-02 01:23
    关注

    Usually core extensions does not have real impact on performances. But some knowns extensions are really performances-killing like Xdebug (which should be strictly reserved to dev environment).

    However if you plan to not make use of some specific extensions you can still make a quick benchmark to test if there's a notable performances changes.

    But to be honest as of php7, they highly improved performances by removing old and greedy code, unsupported SAPI, etc. So you should not be worried at all about that.

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器