I'm trying to get PHP7.2 working on localhost, but phpinfo() keeps saying 7.1.19 is in place while ~php -v tells me PHP7.2.18 is in place.
I run ~php -v it says:
PHP 7.2.18 (cli) (built: May 2 2019 13:03:01) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.18, Copyright (c) 1999-2018, by Zend Technologies
I installed PHP7.2 via brew in
➜ email@example.com pwd
I expect te get on localhost PHP 7.2.18 in place.
Followed these instructions from the link mentioned by @miken32 (How to use the php that brew installed?)
Edited httpd.conf in folder /etc/apache2
#LoadModule php7_module libexec/apache2/libphp7.so LoadModule php7_module /firstname.lastname@example.org/lib/httpd/modules/libphp7.so
If I uncomment the first line and comment the second line, I can run phpinfo() from localhost, however it says it's PHP 7.1.19 and
php -v says 7.2.18
In case I comment the first line and uncomment the second line, localhost won't start and
php -v says 7.2.18
I also followed these steps, but no luck either.
$ brew update php // get the latest homebrew php packages $ brew install email@example.com $ brew link firstname.lastname@example.org // create an alias to this keg-only version; see comments output during installation $ echo 'export PATH="/email@example.com/bin:$PATH"' >> ~/.bash_profile // add the alias to your path; see comments output during installation $ source ~/.bash_profile // reload .bash_profile to use the new settings immediately $ sudo apachectl restart
Also tried brew
link php71 --force but that didn't help either.
So it seems the webserver doesn't start when I switch lines httpd.conf
Any steps I can take the get 7.2.18 going?
➜ apache2 sudo apachectl -t
httpd: Syntax error on line 178 of /private/etc/apache2/httpd.conf: Cannot load /firstname.lastname@example.org/lib/httpd/modules/libphp7.so into server: dlopen(/email@example.com/lib/httpd/modules/libphp7.so, 10): no suitable image found. Did find:\n\firstname.lastname@example.org/lib/httpd/modules/libphp7.so: code signature in (/email@example.com/lib/httpd/modules/libphp7.so) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.\n\firstname.lastname@example.org/lib/httpd/modules/libphp7.so: stat() failed with errno=22
Line 178 says:
LoadModule php7_module /email@example.com/lib/httpd/modules/libphp7.so
Have to look into it. Somewhere on SO in a older post the suggestion was done if there are any 'strange' characters that might cause the error. Verified it and the only strange one is '@'. However that is Brew's out of the box installation.