lara120618's avatar

Brew install PHP 7.2 instead of 7.3

Is there any way to install php 7.2 instead of installing php 7.3 when running brew install php ?

Is there any way to downgrade from php 7.3 to php 7.2 after running brew install php ?

0 likes
21 replies
lara120618's avatar

@REALRANDYALLEN - Yeah but I sort of need to run brew install php for Laravel Valet you see and PHP 7.3 is problematic.

I’ve already got [email protected] but the PHP 7.3 from brew install php is giving me JIT compiler error no memory problems.

Editing PHP 7.3 ini files didn’t help either. Like turning off pure.jit=0 didn’t solve it.

lara120618's avatar

I'm sort of at a loss. Laravel Valet always returns "ErrorException: preg_match(): JIT compilation failed: no more memory" everytime a database query has to be made. Nothing I've done seems to fix it.

I've tried reinstalling the whole thing multiple times with no luck.

lara120618's avatar

@realrandyallen I dont get it. Do you get this error? ErrorException: preg_match(): JIT compilation failed: no more memory

lara120618's avatar

I guess I'll wait till Valet is updated or something.

lara120618's avatar

Is it weird that after I get the error every time I check the database through Sequel Pro, Sequel Pro crashes?

TheMorgz's avatar
TheMorgz
Best Answer
Level 6

Hi @thavarshan

I ran into a similar issue last week.

This is what I did, and I hope this works for you.

Download the following script: https://gist.github.com/dannygsmith/5b74ba708d7bf8621c1cb6b959ece99f/

Run it.

Then do the following steps below.

Update homebrew & upgrade

brew update
brew upgrade

Install php

brew install [email protected]

Install the required PHP to your PATH

echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

Then make sure it's all working

php --version

This command will show you where your ini file is loaded

php --ini

However, I got my valet setup to work with PHP 7.3 using the same steps. So I think it should work if you follow the same steps.

Goodluck, and please let me know if this at least guides you on the right path.

2 likes
lara120618's avatar

@THEMORGZ - Hi there!,

Could you please show me what output you get when you run

php --version
TheMorgz's avatar

Hi @thavarshan,

Because I went with php 7.3, this is the output I get below:

Configuration File (php.ini) Path: /usr/local/etc/php/7.3
Loaded Configuration File:         /usr/local/etc/php/7.3/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.3/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.3/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.3/conf.d/php-memory-limits.ini
kh_dev1's avatar

it works fine but when we restart terminal PHP version will back to version 7.3

callmekai's avatar

I'm getting "502 Bad Gateway nginx/1.19.1" on front-end. I noticed I get a few different PHP versions when running:

brew list | grep php
php
[email protected]
[email protected]

When I try to brew unlink php71 I get Error: No such keg: /usr/local/Cellar/php71 And when I try to uninstall brew uninstall [email protected] I get Error: No installed keg or cask with the name "[email protected]"

I have followed all the troubleshooting in this post, but nothing has helped. Could anyone advice what am I doing wrong, please?!

Please or to participate in this conversation.