phpstringsymfonystripos

mb_stripos huge time difference


Hi I am working on full text search and in my function where i finding string position (for cut x chars before and after string occur) i am using php function mb_stripos(). There is while (code bellow) called few times per request. Strings are from 500 - 100 000 chars long.

But problem is, that on desktop takes this while (called few times per request) cca 500ms, but on server it takes 20 000ms.

Why so horrible difference?


Solution

  • So problem solved: missing library mbstring.

    Solution when using php 7.1.x: apt-get install php7.1-mbstring

    In our situation there was some errors so:

    apt-get update and after that apt-get install php7.1-mbstring and restart apache.