0

I'm having a real struggle to upgrade my php 7.1 to 7.2. I tried running this:

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2

but after a Apache restart if I do a php -v I get:

PHP 7.1.33 (cli) (built: Jan 26 2020 22:52:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

then I thought I would try and install via Homebrew so started following this (the PHP part):

https://gist.github.com/karlhillx/5cd68430aeb25e5e242a3e2c30f238d1

It mentions amending the http.conf file:

vi /usr/local/etc/httpd/httpd.conf 

but my /usr/local/etc look like

ODBCDataSources     locales.conf        openldap        pool.conf
bash_completion.d   odbc.ini        openssl@1.1     wgetrc
freetds.conf        odbcinst.ini        php

I just want to upgrade so I can install the mcrypt extension... Below is my php info output. Any help would be much appreciated.enter image description here

I've run httpd -V:

/private/etc/apache2/httpd.conf

I've amended this file so commented out:

#LoadModule php7_module libexec/apache2/libphp7.so

and added:

LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so

I've run:

sudo apachectl restart
brew services start php@7.2

But PHP now doesn't run. If I do php -v from the command line it's still saying:

PHP 7.1.33 (cli) (built: Jan 26 2020 22:52:32) ( NTS )
``
user3507560
  • 255
  • 4
  • 10
  • 1
    Propably You installed php7.2 but apache has in httpd.conf enabled php7.1. Try to find out your php directory path and add it to httpd.conf after disabling php7.1. – Jakub Ujvvary Oct 21 '20 at 11:02
  • also, dont forget to restart apache and to lauhch the fpm service (if you do fpm) : `brew services php restart` – YvesLeBorg Oct 21 '20 at 11:09
  • you are also (probably) running the previously installed php. Try `/usr/local/bin/php -v` to see if the brew install was correct. If it was, amend your $PATH to include /usr/local/bin before anything else. – YvesLeBorg Oct 21 '20 at 11:21
  • I've updated my original query with some more details. I can see 'php@7.2' in '/usr/local/opt/' - there is no php in '/usr/local/bin' – user3507560 Oct 21 '20 at 12:39

1 Answers1

0

Mac OS have pre-installed Apache, so if You install it via homebrew probably there are two Apache's installed.

First try find currently working:

httpd -V

this also will tell You where is Apache config file. Then You can check wich PHP version is enebled like @jakub-ujvvary said.

  • Thank you - I've tracked down the httpd.conf file (I've updated my orignal question with details) - I've amended this but it's still not pointing to the 7.2? – user3507560 Oct 21 '20 at 12:41
  • what say's `brew services list` ? You sould have something like that `php@7.2 started username /Your/HomeDir/Library/LaunchAgents/homebrew.mxcl.php@7.2.plist` and word "started" have to be at green color – Pinks Not Dead Oct 21 '20 at 13:14
  • php@7.2 started mainUser /Users/mainUser/Library/LaunchAgents/homebrew.mxcl.php@7.2.plist. - (started is in green) – user3507560 Oct 21 '20 at 13:38
  • my last idea and I give up ;) try this brew unlink php@7.1 brew link php@7.2 [https://stackoverflow.com/questions/34909101/how-can-i-easily-switch-between-php-versions-on-mac-osx](https://stackoverflow.com/questions/34909101/how-can-i-easily-switch-between-php-versions-on-mac-osx) – Pinks Not Dead Oct 21 '20 at 13:45
  • `brew unlink php@7.1` returns `Error: No such keg: /usr/local/Cellar/php@7.1` – user3507560 Oct 21 '20 at 15:19
  • The issue seems to be the httpd.conf file - is there anything else that needs to be commented out? – user3507560 Oct 21 '20 at 15:37
  • Could it be that I do not have a `.bash_profile` or `.profile` to add `alias php="/usr/local/opt/php@7.2/bin/php" a to? – user3507560 Oct 21 '20 at 16:09
  • I don't know history of your php instalation, but error with unlink php@7.1 suggests, that it wasn't installed via homebrew and macos see only this version. Adding alias that would be a trick and it wouldn't hurt to try. In my theory macOS is not informed about the new installation 7.2 – Pinks Not Dead Oct 21 '20 at 16:32