macOS Mojave 10.14.5 WEB: 自带的 apache PHP:自带的 php 7.1
原文以下php
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 ...
https://github.com/liip/php-osx/issues/249 上这里找办法! 这里再抄写一次最终的解决步骤html
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/nulllinux
Install apache through homebrew $ brew install httpdgit
Check apache installation through the following command and the output should be /usr/local/bin/apachectl $ which apachectlgithub
Start apache through the following command $ sudo apachectl -k startweb
Set apache to startup on bootload $ sudo brew services start httpdapache
Re-install php from https://php-osx.liip.ch link.bootstrap
我是在先 brew install php 7.2 以后,才看到的以上网址,因此,以上 step 6 我来回浪费了一些时间!由于我在 step 6 最后都是失败的! https://php-osx.liip.ch/ 这里列举了各个 php 版本的重装 php 方式,我尝试了 7.2 和 7.1vim
$ curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2windows
**** [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 通过漫长的下载、等待以后 错误以下:
当时没有抄录下来,大概记得是 did or could not .....
只好冷静下来,一步一步的设置! 想回头,回头的繁琐和继续前行的难度,工做量都不小! (抱歉!我没有使用 TM 的习惯!)
新的 apache 在哪里? $ which apachectl
/usr/local/bin/apachectl
以前记录过,旧的 apache 在
/usr/sbin/httpd
测试一下 打开浏览器,输入 127.0.0.1:8080 It works!
配置文件在哪里 安装的时候没有注意,一时晕乎!后来在 ps 命令下看到了
$ ps -ef |grep httpd
0 84 1 0 5:44下午 ?? 0:00.13 /usr/local/opt/httpd/bin/httpd -D FOREGROUND 70 235 84 0 5:44下午 ?? 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND 70 236 84 0 5:44下午 ?? 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND 70 237 84 0 5:44下午 ?? 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND 70 238 84 0 5:44下午 ?? 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND 70 239 84 0 5:44下午 ?? 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND 70 618 84 0 5:53下午 ?? 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND 70 619 84 0 5:53下午 ?? 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND 70 620 84 0 5:53下午 ?? 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND 501 660 394 0 6:03下午 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 ...
apache2 和 apache-httpd 找了,都不是! 只有找这个 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
看文件清淡和建立时间,应该这就是新的 apache 配置的地方了!
$ vim httpd.conf Listen 8080 改为 Listen 80
sudo apachectl -k restart 再次测试 127.0.0.1,仍是能够显示 It works! 查找 DocumentRoot,看到了如今的 root 位置!
DocumentRoot "/usr/local/var/www" <Directory "/usr/local/var/www">
cd /usr/local/var/www 创建一个 info.php,而后
http://127.0.0.1/info.php 结果原文显示了!说明 php 支持没有安装!
$ cat info.php <?php phpinfo(); ?>
$ brew search php **记录很重要,必定先保存下来,后续问题须要查看
==> 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
$ 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
看到一些 conflicts 和 it was not symlinked into ...,我心虚了! 没有启动新安装的 php!还想回头使用自带的 php 7.1!
** 重要的启动提示信息以下
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
$ sudo vim /usr/local/etc/httpd/httpd.conf 从旧的目录下( /etc/apache2 )的 httpd.conf 找到 php 模块,cp 到新的 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
*** 找不到 libphp7.so 了!
从新设置 php 7.2 以上保存的 php 安装记录中找到 php 设置部分
==> 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
按照提示修改新的 httpd.conf
$ sudo apachectl restart http://127.0.0.1/info.php
终于 ok 了!
1. 中文目录乱码 2. 系统 php 版本和 web 的 php 版本不同 3. brew link 失败 4. php 验证码不显示图片 文章太长了,下一个再继续!