技术碎片
技术记录
帮助交流
recommend
知识杂谈

let test = 'test'

let obj = {[test]:'测试'}

变量作为对象的key使用方法就是加个中括号[]


mac后期版本只有apache 不自带 php环境 需要手动安装

直接开始

安装步骤1:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

2:brew update

3:brew install php@7.4

4:安装完毕会出现提示链路命令  依次输入执行即可 路径为你自己的

  echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc

  echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc

  export LDFLAGS="-L/opt/homebrew/opt/php@7.4/lib"

  export CPPFLAGS="-I/opt/homebrew/opt/php@7.4/include"

5: 关闭终端 打开终端 php -v 可以查看版本即为安装成功


nginx安装1:

brew install nginx

2:nginx -v

3:brew services start nginx    brew services restart nginx

4:配置nginx  /usr/local/etc/nginx/nginx.conf

5: 拷贝以下至nginx.conf既可

#user  nobody;

worker_processes  1;

 

#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;

 

#pid        logs/nginx.pid;

 

 

events {

    worker_connections  1024;

}

 

 

http {

    include       mime.types;

    default_type  application/octet-stream;

 

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

    #                  '$status $body_bytes_sent "$http_referer" '

    #                  '"$http_user_agent" "$http_x_forwarded_for"';

 

    #access_log  logs/access.log  main;

 

    sendfile        on;

    #tcp_nopush     on;

 

    #keepalive_timeout  0;

    keepalive_timeout  65;

 

    #gzip  on;

 

    server {

        listen       80;

        server_name  localhost;

 

        #charset koi8-r;

 

        #access_log  logs/host.access.log  main;

 

        location / {

            root   html;

            index index.php index.html;

        }

 

        #error_page  404              /404.html;

 

        # redirect server error pages to the static page /50x.html

        #

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }

 

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80

        #

        #location ~ \.php$ {

        #    proxy_pass   http://127.0.0.1;

        #}

 

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

        location ~ \.php$ {

            root           html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

            include        fastcgi_params;

        }

 

        # deny access to .htaccess files, if Apache's document root

        # concurs with nginx's one

        #

        #location ~ /\.ht {

        #    deny  all;

        #}

    }

 

 

    # another virtual host using mix of IP-, name-, and port-based configuration

    #

    #server {

    #    listen       8000;

    #    listen       somename:8080;

    #    server_name  somename  alias  another.alias;

 

    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}

 

 

    # HTTPS server

    #

    #server {

    #    listen       443 ssl http2;

    #    server_name  localhost;

 

    #    ssl_certificate      cert.pem;

    #    ssl_certificate_key  cert.key;

 

    #    ssl_session_cache    shared:SSL:1m;

    #    ssl_session_timeout  5m;

 

    #    ssl_ciphers  HIGH:!aNULL:!MD5;

    #    ssl_prefer_server_ciphers  on;

 

    #    location / {

    #        root   html;

    #        index index.php index.html;

    #    }

    #}

    include servers/*;

}


如需apache和nginx共存 修改各自端口即可


安装mysql1:

brew search mysql

2:#指定版本安装 brew install mysql@5.7

3:安装完毕根据提示执行命令即可

  echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc


  export LDFLAGS="-L/opt/homebrew/opt/mysql@5.7/lib"

  export CPPFLAGS="-I/opt/homebrew/opt/mysql@5.7/include"


  brew services restart mysql@5.7


启动服务

mysql.server start

brew services start mysql@5.7


停止服务

mysql.server stop

brew services stop mysql@5.7


4:登录mysql

关闭终端 开启终端  mysql -uroot -p    密码为空



如有疑问或者交流问题请加:QQ 2137087126

转载请注明来源地址:www.zhyunxuan.com 更新时间 2023-02-01  1416
梦想有多远,路就有多远