Be careful with the quote levels on this change (in particular, you need to remove them from PSS(\$m[1]).

Also, if you are having trouble getting the mimetex.cgi script to run:

Make sure that it is in a place where your server recognizes as appropriate for running scripts (e.g., a cgi-bin directory).

Make sure it has the proper execute permissions (755 on a Linux server), including the right http_context if your system uses selinux permissions (Run chcon --type=httpd_fastcgi_script_exec_t mimetex.cgi )

Make sure that the mimetex.cgi path is set correctly in the config.php file. I use $MimetexUrl = '../../cgi-bin/mimetex.cgi'; . You can check this by viewing source on the page created by pmwiki. It should have an <img> tag with a link to the cgi program. Verify that that is the correct path on your server.