MacBook Reloads Apache and PHP 7.2

Posted by twilightnights on Sat, 20 Jul 2019 14:52:29 +0200

20190718 was supposed to do a php verification code, and it turned out that there were no pictures on my macbook, but it was OK on windows! ___________ Judging that the problem lies in the environment!

macOS Mojave 10.14.5 
WEB:  Self-contained apache
PHP: Self-contained php 7.1

After a lot of tossing and turning, the final result is: re-installed apache, re-installed php7.2, because after Apple 10.14, built-in apache, no longer load those third-party component libraries!

The original text is as follows

Detected macOS Mojave 10.14. There are serious issues with it, due to the original apache not loading
foreign libraries anymore. PHP within apache will most certainly not work anymore if you proceed!
The cli version still will.
See this issue at https://github.com/liip/php-osx/issues/249 for details and discussion
...

1. Baidu Search for Information

https://github.com/liip/php-osx/issues/249 Come here and find a way! Here's another copy of the final solution

  1. macOS comes with pre-installed apache, following are the commands to stop it and prevent from autostart on boot: $ sudo apachectl stop $ sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null

  2. Install apache through homebrew $ brew install httpd

  3. Check apache installation through the following command and the output should be /usr/local/bin/apachectl $ which apachectl

  4. Start apache through the following command $ sudo apachectl -k start

  5. Set apache to startup on bootload $ sudo brew services start httpd

  6. Re-install php from https://php-osx.liip.ch link.

2. My mistake

I saw the above address after brew install php 7.2, so I wasted some time back and forth in step 6 above! Because I failed in step 6! https://php-osx.liip.ch/ Here's a list of php refactoring methods for various php versions. I tried 7.2 and 7.1

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

****
[WARNING]
Detected macOS Mojave 10.14. There are serious issues with it, due to the original apache not loading
foreign libraries anymore. PHP within apache will most certainly not work anymore if you proceed!
The cli version still will.
See this issue at https://github.com/liip/php-osx/issues/249 for details and discussion
****
Restart this script with
 curl -s https://php-osx.liip.ch/install.sh | bash -s force 7.2
to really install it
****

$ curl -s https://php-osx.liip.ch/install.sh | bash -s force 7.2 After a long download and wait The mistakes are as follows:

I didn't transcribe it at that time. I probably remember that.
did or could not .....

Have to calm down, step by step settings! Want to go back, back to the tedious and difficult to continue to move forward, the workload is not small! (Sorry! I'm not used to TM!

3. Setting apache

  1. Where is the new apache? $ which apachectl

     /usr/local/bin/apachectl
    

    As previously recorded, the old apache is in the

     /usr/sbin/httpd
    
  2. Test it out Open the browser and enter 127.0.0.1:8080 It works!

  3. Where is the configuration file? Installation did not pay attention, temporary dizziness! Later I saw it under the ps command.

    $ ps -ef |grep httpd

     0    84     1   0  5:44 Afternoon ??         0:00.13 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
    70   235    84   0  5:44 Afternoon ??         0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
    70   236    84   0  5:44 Afternoon ??         0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
    70   237    84   0  5:44 Afternoon ??         0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
    70   238    84   0  5:44 Afternoon ??         0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
    70   239    84   0  5:44 Afternoon ??         0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
    70   618    84   0  5:53 Afternoon ??         0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
    70   619    84   0  5:53 Afternoon ??         0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
        70   620    84   0  5:53 Afternoon ??         0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
       501   660   394   0  6:03 Afternoon ttys000    0:00.00 grep httpd
    

$ cd /usr/local/opt/ $ ls -l

total 0
lrwxr-xr-x  1 dhbm  admin  22  7 18 17:05 apache-httpd -> ../Cellar/httpd/2.4.34
lrwxr-xr-x  1 dhbm  admin  22  7 18 17:05 apache2 -> ../Cellar/httpd/2.4.34
  ...
  lrwxr-xr-t  1 dhbm  admin  22  7 18 17:05 httpd -> ../Cellar/httpd/2.4.34
  ...

Apache 2 and apache-httpd were found, neither! Only find this httpd

$ cd /usr/local/etc/httpd/ $ ls -l

total 200
-rw-r--r--   1 dhbm  admin      0  7 18 21:09 Caveats
drwxr-xr-x  14 dhbm  admin    448  7 18 17:05 extra
-rw-r--r--   1 dhbm  admin  21958  7 18 21:24 httpd.conf
-rw-r--r--   1 dhbm  admin  13077  7 18 17:05 magic
-rw-r--r--   1 dhbm  admin  60847  7 18 17:05 mime.types
drwxr-xr-x   4 dhbm  admin    128  7 18 17:05 original

Look at the file lightness and creation time, this should be where the new apache configuration is!

$ vim httpd.conf Change Listen 8080 to Listen 80

sudo apachectl -k restart Test 127.0.0.1 again, or you can display It works! Find the Document root and see where it is now!

DocumentRoot "/usr/local/var/www"
<Directory "/usr/local/var/www">

cd /usr/local/var/www Create an info.php, and then

http://127.0.0.1/info.php The result shows! Explain that php support is not installed!

$ cat info.php <?php phpinfo(); ?>

3. Install php 7.2

  1. $ brew search php ** Records are very important. They must be saved first. Follow-up questions need to be checked.

     ==> Formulae
     brew-php-switcher
     php
     php-code-sniffer
     php-cs-fixer
     php@5.6
     php@7.0
     php@7.1 ✔
     phplint
     phpmyadmin
     phpunit
     homebrew/linuxbrew-core/brew-php-switcher
     homebrew/linuxbrew-core/php
     homebrew/linuxbrew-core/php-code-sniffer
     homebrew/linuxbrew-core/php-cs-fixer
     homebrew/linuxbrew-core/php@5.6
     homebrew/linuxbrew-core/php@7.1
     homebrew/linuxbrew-core/php@7.2
    
     ==> Casks
     eclipse-php                netbeans-php               phpstorm
    
  2. $ brew install php72

     pdating Homebrew...
     Fast-forwarded master to origin/master.
     ==> Auto-updated Homebrew!
     Updated 1 tap (homebrew/cask).
     No changes to formulae.
    
     ==> Installing dependencies for php: apr, openssl, apr-util, argon2, aspell, autoconf, freetds, libffi, pcre, glib, gmp, icu4c, libpq, libsodium, libzip, unixodbc
     ==> Installing php dependency: apr
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/apr-1.6.3.h
     ######################################################################## 100.0%
     ==> Pouring apr-1.6.3.high_sierra.bottle.tar.gz
     ==> Caveats
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because Apple's CLT package contains apr.
    
     If you need to have this software first in your PATH run:
       echo 'export PATH="/usr/local/opt/apr/bin:$PATH"' >> ~/.bash_profile
    
     ==> Summary
     🍺  /usr/local/Cellar/apr/1.6.3: 60 files, 1.3MB
     ==> Installing php dependency: openssl
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openssl-1.0
     ######################################################################## 100.0%
     ==> Pouring openssl-1.0.2o_2.high_sierra.bottle.tar.gz
     ==> Caveats
     A CA file has been bootstrapped using certificates from the SystemRoots
     keychain. To add additional certificates (e.g. the certificates added in
     the System keychain), place .pem files in
       /usr/local/etc/openssl/certs
    
     and run
       /usr/local/opt/openssl/bin/c_rehash
    
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
    
     If you need to have this software first in your PATH run:
       echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
    
     For compilers to find this software you may need to set:
         LDFLAGS:  -L/usr/local/opt/openssl/lib
         CPPFLAGS: -I/usr/local/opt/openssl/include
    
     ==> Summary
     🍺  /usr/local/Cellar/openssl/1.0.2o_2: 1,792 files, 12.3MB
     ==> Installing php dependency: apr-util
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/apr-util-1.
     ######################################################################## 100.0%
     ==> Pouring apr-util-1.6.1_1.high_sierra.bottle.tar.gz
     ==> Caveats
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because Apple's CLT package contains apr.
    
     If you need to have this software first in your PATH run:
       echo 'export PATH="/usr/local/opt/apr-util/bin:$PATH"' >> ~/.bash_profile
    
     ==> Summary
     🍺  /usr/local/Cellar/apr-util/1.6.1_1: 54 files, 778.2KB
     ==> Installing php dependency: argon2
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/argon2-2017
     ######################################################################## 100.0%
     ==> Pouring argon2-20171227.high_sierra.bottle.tar.gz
     🍺  /usr/local/Cellar/argon2/20171227: 11 files, 590KB
     ==> Installing php dependency: aspell
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/aspell-0.60
     ######################################################################## 100.0%
     ==> Pouring aspell-0.60.6.1_1.high_sierra.bottle.tar.gz
     ==> Caveats
     Installation of the 'is' (Icelandic) and 'nb' (Norwegian) dictionaries is
     currently broken. They can be installed manually.
    
     See: https://github.com/Homebrew/homebrew-core/issues/28074
     ==> Summary
     🍺  /usr/local/Cellar/aspell/0.60.6.1_1: 267 files, 35.6MB
     ==> Installing php dependency: autoconf
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/autoconf-2.
     ######################################################################## 100.0%
     ==> Pouring autoconf-2.69.high_sierra.bottle.4.tar.gz
     Error: The `brew link` step did not complete successfully
     The formula built, but is not symlinked into /usr/local
     Could not symlink bin/autoconf
     Target /usr/local/bin/autoconf
     already exists. You may want to remove it:
       rm '/usr/local/bin/autoconf'
    
     To force the link and overwrite all conflicting files:
       brew link --overwrite autoconf
    
     To list all files that would be deleted:
       brew link --overwrite --dry-run autoconf
    
     Possible conflicting files are:
     /usr/local/bin/autoconf
     /usr/local/bin/autoheader
     /usr/local/bin/autom4te
     /usr/local/bin/autoreconf
     /usr/local/bin/autoscan
     /usr/local/bin/autoupdate
     /usr/local/bin/ifnames
     /usr/local/share/autoconf/Autom4te/C4che.pm
     /usr/local/share/autoconf/Autom4te/ChannelDefs.pm
     /usr/local/share/autoconf/Autom4te/Channels.pm
     /usr/local/share/autoconf/Autom4te/Configure_ac.pm
     /usr/local/share/autoconf/Autom4te/FileUtils.pm
     /usr/local/share/autoconf/Autom4te/General.pm
     /usr/local/share/autoconf/Autom4te/Getopt.pm
     /usr/local/share/autoconf/Autom4te/Request.pm
     /usr/local/share/autoconf/Autom4te/XFile.pm
     /usr/local/share/autoconf/INSTALL
     /usr/local/share/autoconf/autoconf/autoconf.m4
     /usr/local/share/autoconf/autoconf/autoconf.m4f
     /usr/local/share/autoconf/autoconf/autoheader.m4
     /usr/local/share/autoconf/autoconf/autoscan.m4
     /usr/local/share/autoconf/autoconf/autotest.m4
     /usr/local/share/autoconf/autoconf/autoupdate.m4
     /usr/local/share/autoconf/autoconf/c.m4
     /usr/local/share/autoconf/autoconf/erlang.m4
     /usr/local/share/autoconf/autoconf/fortran.m4
     /usr/local/share/autoconf/autoconf/functions.m4
     /usr/local/share/autoconf/autoconf/general.m4
     /usr/local/share/autoconf/autoconf/go.m4
     /usr/local/share/autoconf/autoconf/headers.m4
     /usr/local/share/autoconf/autoconf/lang.m4
     /usr/local/share/autoconf/autoconf/libs.m4
     /usr/local/share/autoconf/autoconf/oldnames.m4
     /usr/local/share/autoconf/autoconf/programs.m4
     /usr/local/share/autoconf/autoconf/specific.m4
     /usr/local/share/autoconf/autoconf/status.m4
     /usr/local/share/autoconf/autoconf/types.m4
     /usr/local/share/autoconf/autom4te.cfg
     /usr/local/share/autoconf/autoscan/autoscan.list
     /usr/local/share/autoconf/autotest/autotest.m4
     /usr/local/share/autoconf/autotest/autotest.m4f
     /usr/local/share/autoconf/autotest/general.m4
     /usr/local/share/autoconf/autotest/specific.m4
     /usr/local/share/autoconf/m4sugar/foreach.m4
     /usr/local/share/autoconf/m4sugar/m4sh.m4
     /usr/local/share/autoconf/m4sugar/m4sh.m4f
     /usr/local/share/autoconf/m4sugar/m4sugar.m4
     /usr/local/share/autoconf/m4sugar/m4sugar.m4f
     /usr/local/share/autoconf/m4sugar/version.m4
     /usr/local/share/info/autoconf.info
     /usr/local/share/man/man1/autoconf.1
     /usr/local/share/man/man1/autoheader.1
     /usr/local/share/man/man1/autom4te.1
     /usr/local/share/man/man1/autoreconf.1
     /usr/local/share/man/man1/autoscan.1
     /usr/local/share/man/man1/autoupdate.1
     /usr/local/share/man/man1/config.guess.1
     /usr/local/share/man/man1/config.sub.1
     /usr/local/share/man/man1/ifnames.1
     ==> Caveats
     Emacs Lisp files have been installed to:
       /usr/local/share/emacs/site-lisp/autoconf
     ==> Summary
     🍺  /usr/local/Cellar/autoconf/2.69: 71 files, 3.0MB
     ==> Installing php dependency: freetds
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/freetds-1.0
     ######################################################################## 100.0%
     ==> Pouring freetds-1.00.94.high_sierra.bottle.tar.gz
     🍺  /usr/local/Cellar/freetds/1.00.94: 2,094 files, 11.9MB
     ==> Installing php dependency: libffi
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libffi-3.2.
     ######################################################################## 100.0%
     ==> Pouring libffi-3.2.1.high_sierra.bottle.tar.gz
     ==> Caveats
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because some formulae require a newer version of libffi.
    
     For compilers to find this software you may need to set:
         LDFLAGS:  -L/usr/local/opt/libffi/lib
    
     ==> Summary
     🍺  /usr/local/Cellar/libffi/3.2.1: 16 files, 297.0KB
     ==> Installing php dependency: pcre
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/pcre-8.42.h
     ######################################################################## 100.0%
     ==> Pouring pcre-8.42.high_sierra.bottle.tar.gz
     🍺  /usr/local/Cellar/pcre/8.42: 204 files, 5.3MB
     ==> Installing php dependency: glib
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/glib-2.56.1
     ######################################################################## 100.0%
     ==> Pouring glib-2.56.1.high_sierra.bottle.tar.gz
     🍺  /usr/local/Cellar/glib/2.56.1: 430 files, 23.7MB
     ==> Installing php dependency: gmp
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/gmp-6.1.2_2
     ######################################################################## 100.0%
     ==> Pouring gmp-6.1.2_2.high_sierra.bottle.tar.gz
     🍺  /usr/local/Cellar/gmp/6.1.2_2: 18 files, 3.1MB
     ==> Installing php dependency: icu4c
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/icu4c-62.1.
     ######################################################################## 100.0%
     ==> Pouring icu4c-62.1.high_sierra.bottle.tar.gz
     ==> Caveats
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because macOS provides libicucore.dylib (but nothing else).
    
     If you need to have this software first in your PATH run:
       echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
       echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile
    
     For compilers to find this software you may need to set:
         LDFLAGS:  -L/usr/local/opt/icu4c/lib
         CPPFLAGS: -I/usr/local/opt/icu4c/include
    
     ==> Summary
     🍺  /usr/local/Cellar/icu4c/62.1: 250 files, 67.3MB
     ==> Installing php dependency: libpq
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libpq-10.4.
     ######################################################################## 100.0%
     ==> Pouring libpq-10.4.high_sierra.bottle.tar.gz
     ==> Caveats
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because conflicts with postgres formula.
    
     If you need to have this software first in your PATH run:
       echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile
    
     For compilers to find this software you may need to set:
         LDFLAGS:  -L/usr/local/opt/libpq/lib
         CPPFLAGS: -I/usr/local/opt/libpq/include
    
     ==> Summary
     🍺  /usr/local/Cellar/libpq/10.4: 2,430 files, 26.9MB
     ==> Installing php dependency: libsodium
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libsodium-1
     ######################################################################## 100.0%
     ==> Pouring libsodium-1.0.16.high_sierra.bottle.tar.gz
     🍺  /usr/local/Cellar/libsodium/1.0.16: 71 files, 945.1KB
     ==> Installing php dependency: libzip
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libzip-1.5.
     ######################################################################## 100.0%
     ==> Pouring libzip-1.5.1.high_sierra.bottle.tar.gz
     🍺  /usr/local/Cellar/libzip/1.5.1: 134 files, 577KB
     ==> Installing php dependency: unixodbc
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/unixodbc-2.
     ######################################################################## 100.0%
     ==> Pouring unixodbc-2.3.6.high_sierra.bottle.tar.gz
     🍺  /usr/local/Cellar/unixodbc/2.3.6: 46 files, 1.8MB
     ==> Installing php
     ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/php-7.2.8.h
     ######################################################################## 100.0%
     ==> Pouring php-7.2.8.high_sierra.bottle.tar.gz
     Error: The `brew link` step did not complete successfully
     The formula built, but is not symlinked into /usr/local
     Could not symlink sbin/php-fpm
     /usr/local/sbin is not writable.
    
     You can try again using:
       brew link php
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set php_ini /usr/local/etc/php/7
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set php_dir /usr/local/share/pea
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set doc_dir /usr/local/share/pea
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set ext_dir /usr/local/lib/php/p
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set bin_dir /usr/local/opt/php/b
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set data_dir /usr/local/share/pe
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set cfg_dir /usr/local/share/pea
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set www_dir /usr/local/share/pea
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set man_dir /usr/local/share/man
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set test_dir /usr/local/share/pe
     ==> /usr/local/Cellar/php/7.2.8/bin/pear config-set php_bin /usr/local/opt/php/b
     ==> /usr/local/Cellar/php/7.2.8/bin/pear update-channels
     ==> Caveats
     To enable PHP in Apache add the following to httpd.conf and restart Apache:
         LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so
    
         <FilesMatch \.php$>
             SetHandler application/x-httpd-php
         </FilesMatch>
    
     Finally, check DirectoryIndex includes index.php
         DirectoryIndex index.php index.html
    
     The php.ini and php-fpm.ini file can be found in:
         /usr/local/etc/php/7.2/
    
     To have launchd start php now and restart at login:
       brew services start php
     Or, if you don't want/need a background service you can just run:
       php-fpm
     ==> Summary
     🍺  /usr/local/Cellar/php/7.2.8: 515 files, 79.1MB
     ==> Caveats
     ==> apr
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because Apple's CLT package contains apr.
    
     If you need to have this software first in your PATH run:
       echo 'export PATH="/usr/local/opt/apr/bin:$PATH"' >> ~/.bash_profile
    
     ==> openssl
     A CA file has been bootstrapped using certificates from the SystemRoots
     keychain. To add additional certificates (e.g. the certificates added in
     the System keychain), place .pem files in
       /usr/local/etc/openssl/certs
    
     and run
       /usr/local/opt/openssl/bin/c_rehash
    
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
    
     If you need to have this software first in your PATH run:
       echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
    
     For compilers to find this software you may need to set:
         LDFLAGS:  -L/usr/local/opt/openssl/lib
         CPPFLAGS: -I/usr/local/opt/openssl/include
    
     ==> apr-util
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because Apple's CLT package contains apr.
    
     If you need to have this software first in your PATH run:
       echo 'export PATH="/usr/local/opt/apr-util/bin:$PATH"' >> ~/.bash_profile
    
     ==> aspell
     Installation of the 'is' (Icelandic) and 'nb' (Norwegian) dictionaries is
     currently broken. They can be installed manually.
    
     See: https://github.com/Homebrew/homebrew-core/issues/28074
     ==> autoconf
     Emacs Lisp files have been installed to:
       /usr/local/share/emacs/site-lisp/autoconf
     ==> libffi
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because some formulae require a newer version of libffi.
    
     For compilers to find this software you may need to set:
         LDFLAGS:  -L/usr/local/opt/libffi/lib
    
     ==> icu4c
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because macOS provides libicucore.dylib (but nothing else).
    
     If you need to have this software first in your PATH run:
       echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
       echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile
    
     For compilers to find this software you may need to set:
         LDFLAGS:  -L/usr/local/opt/icu4c/lib
         CPPFLAGS: -I/usr/local/opt/icu4c/include
    
     ==> libpq
     This formula is keg-only, which means it was not symlinked into /usr/local,
     because conflicts with postgres formula.
    
     If you need to have this software first in your PATH run:
       echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile
    
     For compilers to find this software you may need to set:
         LDFLAGS:  -L/usr/local/opt/libpq/lib
         CPPFLAGS: -I/usr/local/opt/libpq/include
    
     ==> php
     To enable PHP in Apache add the following to httpd.conf and restart Apache:
         LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so
    
         <FilesMatch \.php$>
             SetHandler application/x-httpd-php
         </FilesMatch>
    
     Finally, check DirectoryIndex includes index.php
         DirectoryIndex index.php index.html
    
     The php.ini and php-fpm.ini file can be found in:
         /usr/local/etc/php/7.2/
    
     To have launchd start php now and restart at login:
       brew services start php
     Or, if you don't want/need a background service you can just run:
       php-fpm
    

Seeing some conflicts and it wasn't symlinked in... I feel guilty! No newly installed php started! I also want to go back to using my own php 7.1!

** Important startup information is as follows

To have launchd start php now and restart at login:
  brew services start php
Or, if you don't want/need a background service you can just run:
  php-fpm
==> Summary
🍺  /usr/local/Cellar/php/7.2.8: 515 files, 79.1MB
  1. $ sudo vim /usr/local/etc/httpd/httpd.conf httpd.conf from the old directory (/etc/apache2) Find the php module, cp to the new httpd.conf

    $ sudo apachectl restart httpd: Syntax error on line 187 of /usr/local/etc/httpd/httpd.conf: Cannot load libexec/apache2/libphp7.so into server: dlopen(/usr/local/opt/httpd/libexec/apache2/libphp7.so, 10): image not found

*** No libphp7.so!

  1. Reset php 7.2 Find the php settings section in the php installation record saved above

     ==> php
     To enable PHP in Apache add the following to httpd.conf and restart Apache:
         LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so
    
         <FilesMatch \.php$>
             SetHandler application/x-httpd-php
         </FilesMatch>
    
     Finally, check DirectoryIndex includes index.php
         DirectoryIndex index.php index.html
    
     The php.ini and php-fpm.ini file can be found in:
         /usr/local/etc/php/7.2/
    
     To have launchd start php now and restart at login:
       brew services start php
     Or, if you don't want/need a background service you can just run:
       php-fpm
    

Modify the new httpd.conf as prompted

$ sudo apachectl restart http://127.0.0.1/info.php

ok at last!

4. Follow-up issues

1. Chinese Catalogue Scrambling
 2. The php version of the system is different from the php version of the web.
3. brew link failed
 4. php authentication code does not display pictures
 The article is too long. Continue next!

Topics: Operation & Maintenance PHP Apache OpenSSL brew