Solvedhomebrew core Formula php@5.6 not working on macOS 10.14 (Mojave)

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • are reporting a bug others will be able to reproduce and not asking a question. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh

Yes, it is reproducible. In particular, on a fresh install of Mojave...I can't test on an upgrade to Mojave, because I did a fresh install.

The problem is not with brew itself (I have several other formulas running great), it's just related to php@5.6 on macOS 10.14.

  • ran brew update and can still reproduce the problem?

It was a fresh install of brew using the command from https://brew.sh.

$ brew update
Already up-to-date.
  • ran brew doctor, fixed all issues and can still reproduce the problem?
$ brew doctor
Your system is ready to brew.
  • ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?

https://gist.github.com/77a1f19af7a12120e577ac1386d6f5d7

  • if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

It worked, see above.

To help us debug your issue please explain:

  • What you were trying to do (and why)

Run php@5.6 because I have an older application to support.
In particular, I'm using php-fpm because I'm using nginx instead of Apache.
I attempted to both use the default networking port 127.0.0.1:9000, and a unix socket. Both were the same. I tried starting PHP with both my standard user, and sudo; there was no difference in the result.

  • What happened (include command output)

Nothing from php itself, and I did set the error_log variable in the php.ini.

Nginx would say:

2018/09/26 21:15:15 [error] 19990#0: *6 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1"

PHP-FPM would say:

[26-Sep-2018 21:15:15] WARNING: [pool www] child 20479 exited on signal 11 (SIGSEGV) after 4.343179 seconds from start
[26-Sep-2018 21:15:15] NOTICE: [pool www] child 20481 started
  • What you expected to happen

I expected PHP to run, or at a minimum, produce an error.

  • Step-by-step reproduction instructions (by running brew install commands)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install nginx
brew install php@5.6

Edit path to include php before /usr/local/sbin, something like:
export PATH="/usr/local/opt/php@5.6/bin:/usr/local/opt/php@5.6/sbin:/usr/local/sbin:$PATH"

Uncomment the default proxy config in nginx.conf, and fix SCRIPT_FILENAME param:

location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

Start/restart PHP & nginx (using sudo on nginx because on port 80):

sudo brew services start nginx
brew services start php

This SHOULD work, but doesn't.

All I had to do to get it to work is:

  • Stop php@5.6
    brew services stop php

  • Install 7.2:
    brew install php

  • Update PATH:
    export PATH="/usr/local/opt/php@7.2/bin:/usr/local/opt/php@7.2/sbin:/usr/local/sbin:$PATH"

  • Start php:
    brew services start php

Working on php 7.2!

Please let me know if there is any other info you need.

14 Answers

✔️Accepted Answer

I was able to track the issue down to the packaged OPcache extension.

If I change the opcache.so file that is being loaded to the one that is packaged with the above mentioned distribution, this formula works fine.

/usr/local/etc/php/5.6/conf.d/ext-opcache.ini

[opcache]
;zend_extension=/usr/local/opt/php@5.6/lib/php/20131226/opcache.so
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/opcache.so

(Just not loading OPcache also works.)

More Issues: