Skip to content

Instantly share code, notes, and snippets.

@lirongfei123
Last active February 27, 2019 02:59
Show Gist options
  • Save lirongfei123/32815d6533dba16b10b46eed34244ef0 to your computer and use it in GitHub Desktop.
Save lirongfei123/32815d6533dba16b10b46eed34244ef0 to your computer and use it in GitHub Desktop.
php #mac

解决 PHP 7.2.8 + MySQL 8.0.12 连接失败的问题

Unexpected server respose while doing caching_sha2 auth: 109

[mysqld]
default_authentication_plugin= mysql_native_password
/usr/local/bin/mysql.server restart

vi /usr/local/etc/my.cnf
location ~ \.php$ {
            root           /Users/Evai/web; #你存放的php页面路径
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
}

brew install php

To enable PHP in Apache add the following to httpd.conf and restart Apache: LoadModule php7_module /usr/local/opt/[email protected]/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/

[email protected] is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
To have launchd start [email protected] now and restart at login:
  brew services start [email protected]
Or, if you don't want/need a background service you can just run:
  php-fpm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment