javascript - MathJax equations are not displayed on my new site but work fine on its exact copy -


the problem

i in process of migrating website webserver.

the problem on new site latex equations not displayed.

the configuration

  1. i used wordpress plugin "duplicator" copy site 1 server another.
  2. i have exact same plugins on each website , exact same configuration.

i use plugin latex wordpress display equations:

both of them using cdn mathjax.

what tried

  • i tried change cdn on new site , did not work
  • i tried running http or https versions of cdn , did not change anything
  • i tried running simple html page cdn , equation displayed correctly, telling me not seems cdn related.
  • i tried clear cache of browser, tried use different browsers, no difference

so though because of plugin:

  • i tried disabling every plugin except latex wordpress plugin , did not work
  • i compared each php file of plugin between 2 versions , have same content
  • the configuration of plugin strictly same
  • i tried comparing generated html code between 2 pages , see there 8 mathjax related style in old site, , 5 on new site.

the style classes:

 .mathjax_preview   .mathjax_hover_frame   .mathjax_display  #mathjax_about  #mathjax_zoom 

but in working version there styles classes:

.mathjax_preview .mjxf-math  .mjx_assistive_mathml .mjxp-script 

moreover found generated html code different.

example of code on working test page:

<script type="math/tex" id="mathjax-element-1">1+x=x^2</script> 

we can see math "1+x=x^2" inside script.

but on non working page, math gone:

<script type="math/tex" id="mathjax-element-1"></script></p> 

when page load, can see preview image being displayed, , dissapear.

the question

what can cause of problem? how can fix it?

---------------- edit -----------------

the answer

the problem version of php.

i using php 7.1 on new server , 5.6 on old one.

the plugin using regex make text replacement:

$text= preg_replace('/&#x([a-f0-9]+);/mei',"chr(0x\\1)",$text);  

by removing /e flag in each preg_replace function fixed plugin.

$text= preg_replace('/&#x([a-f0-9]+);/mi',"chr(0x\\1)",$text);  


Comments