Confusing Error message

Could someone help with this error message I am suddenly getting on my local site

Unexpected error: preg_replace(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in NameHelper.php on line 14

You could try to add pcre.jit=0 to your php.ini file or select a lower php version. Which php version are you using right now?

Anyway, that’s something for @ben to look at.

Thanks, I carried on doing some research and found that information as well and it works, I have PHP 8.1.2 installed via Homebrew on a MacBook 16" M1. Took a bit of research to get PHP running due to certificate issues. Once it was working I then got the above error. I am still getting some issue like “is_file(): Passing null to parameter #1 ($filename) of type string is deprecated in WebImageHelper.php on line 230” and “preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in 90-page-3.0.4-37-8-menu_21-88-index-2.0.1-38-8-2.view-2.template on line 124” plus having to refresh pages before they display as https rather than a page error. I still have to slowly work through permissions etc But its a slow process

The JIT error has already been covered above. Try both options of pcre.jit=0 or pcre.jit=1, make sure that the value you’ve set it to is reflected in the PHP Info page and see whether one of them solves the issue.
The is_file error has been fixed in a silent update. Update Backlight through your modules page to get that fix.
The array|string is deprecated error is new to me and I can also see it on 8.1.2.

I suggest that you do not use such cutting-edge versions of PHP. 8.1.2 was released all of five days ago. We can not provide such immediate support for new releases.

Thanks will look at your suggestions. I did not realise that 8.1.2 was that new. It is the Default home-brew install. My new M1 mac did not have php so i needed to install, and reinstall Homewbrew as well original was intel version. Will see if i can find a way of installing an earlier version, I was running PHP8 happily on my old intel mac.

Hi @speacock110, I’ve addressed that issue and potentially some further issues with 8.1.2. This is in an update available in the Backlight Modules.

Thanks just updated to 4.1.2 Still getting “preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in WebImage.php on line 122” though. Did the usual of Clear template Cache and clear browser cache, checked on another browser as well

Did you do update or reinstall all? I would try the latter.

tried reinstall all still no change, says 4.1.2 at the bottom of the page

Hi @speacock110, I have made further updates in 4.1.2 to address this. Can you try reinstalling the main Backlight modules by clicking Reinstall All under Backlight 4 on the Backlight Modules page?

These issues will likely keep popping up in different parts of Backlight under 8.1.2.

It looks like you can select the PHP version with Homebrew as well: https://localheinz.com/blog/2020/05/05/switching-between-php-versions-when-using-homebrew/

This is the approach I use: https://getgrav.org/blog/macos-monterey-apache-multiple-php-versions

I then switch between three versions with these commands:

sphp 7.4
sphp 8.0
sphp 8.1

Alternatively, MAMP works well and may give you less of a headache. I keep MAMP running on port 8888 with either PHP 5.4 or 5.6 and pass traffic through via Homebrew’s https vhosts file. That approach lets me run different sites on different versions of PHP without needing to switch versions.

1 Like

Thanks, I am in the middle of using the home-brew set-up as it looks cleaner for me than the others. It works fine including PHP version change using sphp Just having issues with my vhosts. I have 4 Vhosts normally running all in separate folders in my sites folder. Currently my system is ignoring my Vhosts file. HTTP://localhost/foldername/ works fine but HTTP://foldername.sites does not (foldername.sites is what I use as the URL

Have you added the local URL to the /etc/hosts file?

yes they were already there from the previous setup. Slowly starting to work by small changes to config files.

Finally got it fully working on all my local sites, not sure exactly what i did and what fixed what. Had to do lots of tidying up as vhost files and host file a bit of a mess then a site had the wrong certificate, plus some browsers worked and other didn’t. Anyway finally got all working and did reinstall all in the modules which resulted in all message going away for php 8.1.2. But will change back to 8.0 for a while.

So thanks for your help feel a lot happier using a server independent of Apples