Mac M2芯片配置PHP环境

Mac M2芯片配置PHP环境

  • 1. XAMPP
  • 2. PHPBrew(PHP版本管理)
    • 安装php7.4.33版本
  • 3. 直接使用homebrew 安装php环境
  • 参考

1. XAMPP

官网地址 https://www.apachefriends.org/

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

安装
在这里插入图片描述
安装完成
在这里插入图片描述

web server打开后,在打开localhost 成功!
在这里插入图片描述

在这里插入图片描述

2. PHPBrew(PHP版本管理)

官方文档 https://github.com/phpbrew/phpbrew/blob/master/README.cn.md
HomeBrew关于 PHPBrew的文档 https://formulae.brew.sh/formula/phpbrew

安装
这里我们通过homebrew安装

brew install phpbrew

在这里插入图片描述
在这里插入图片描述

init
在这里插入图片描述

Using root: /Users/fanzhen/.phpbrew
Initialization successfully finished!
<=====================================================>
Phpbrew environment is initialized, required directories are created under/Users/fanzhen/.phpbrewPaste the following line(s) to the end of your ~/.bashrc and start a
new shell, phpbrew should be up and fully functional from there:source /Users/fanzhen/.phpbrew/bashrcTo enable PHP version info in your shell prompt, please set PHPBREW_SET_PROMPT=1
in your `~/.bashrc` before you source `~/.phpbrew/bashrc`export PHPBREW_SET_PROMPT=1To enable .phpbrewrc file searching, please export the following variable:export PHPBREW_RC_ENABLE=1For further instructions, simply run `phpbrew` to see the help message.Enjoy phpbrew at $HOME!!<=====================================================>

在这里插入图片描述

# phpbrew
source /Users/fanzhen/.phpbrew/bashrc
export PHPBREW_SET_PROMPT=1
export PHPBREW_RC_ENABLE=1

之后就可以正常使用了
在这里插入图片描述

安装php7.4.33版本

phpbrew install 7.4.33 +default

在这里插入图片描述
但是这里下载的速度太慢了需要解决!!!

3. 直接使用homebrew 安装php环境

1、查看 php 版本

php -v

此时发现没有php环境的话,就全新安装

2、brew tap加速,使用github库
homebrew默认使用官方的库,但这个源很慢,一般我们会使用第三方tap

brew tap shivammathur/php

3、安装php7.4

brew install shivammathur/php/php@7.4

4、创建link,这样可以在全局环境里访问

brew link --overwrite --force php@74

在这里插入图片描述
在这里插入图片描述

==> Summary
🍺  /opt/homebrew/Cellar/php@7.4/7.4.33_5: 499 files, 72.9MB
==> Running `brew cleanup php@7.4`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> php@7.4
To enable PHP in Apache add the following to httpd.conf and restart Apache:LoadModule php7_module /opt/homebrew/opt/php@7.4/lib/httpd/modules/libphp7.so<FilesMatch \.php$>SetHandler application/x-httpd-php</FilesMatch>Finally, check DirectoryIndex includes index.phpDirectoryIndex index.php index.htmlThe php.ini and php-fpm.ini file can be found in:/opt/homebrew/etc/php/7.4/php@7.4 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.If you need to have php@7.4 first in your PATH, run:echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrcecho 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrcFor compilers to find php@7.4 you may need to set:export LDFLAGS="-L/opt/homebrew/opt/php@7.4/lib"export CPPFLAGS="-I/opt/homebrew/opt/php@7.4/include"To start shivammathur/php/php@7.4 now and restart at login:brew services start shivammathur/php/php@7.4
Or, if you don't want/need a background service you can just run:/opt/homebrew/opt/php@7.4/sbin/php-fpm --nodaemonize

在这里插入图片描述

# php7.4
export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"
export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/php@7.4/lib"
export CPPFLAGS="-I/opt/homebrew/opt/php@7.4/include"

在这里插入图片描述

参考

  1. PHPBrew 使用指南 https://www.jianshu.com/p/d5b0d40e56ee
  2. phpbrew set mirror(加速)https://minbaby.github.io/post/2018-11/phpbrew-set-mirror/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/472950.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Dynamo读取Revit警告

Hello大家好&#xff01;我是九哥~ 之前看到群里小伙伴经常会问如何去掉Revit重复的图元&#xff0c;有推荐各种插件的&#xff0c;其实的&#xff0c;Revit本身就会提示你有哪些图元是重复的&#xff0c;就在管理选项卡下面的警告里&#xff0c;即查阅警告信息。 点击警告后…

使用html-webpack-plugin对HTML文件进行预处理

原文地址&#xff1a;https://segmentfault.com/a/1190000021518323作者&#xff1a;Fw恶龙本文首发于&#xff1a;思否 一、前言 先整理一波之前和webpack相关的文章: 使用Webpack对CSS文件进行后处理基于Webpack的CSS Sprites实现方案Stylus系列——webpack-spritesmith配合…

二、ActiveMQ安装

ActiveMQ安装 一、相关环境二、安装Java8三、下载安装包四、启动五、其他命令六、开放端口七、后台管理 一、相关环境 环境&#xff1a;Centos7.9安装ActiveMQ版本&#xff1a;5.15.9JDK8 二、安装Java8 安装教程&#xff1a;https://qingsi.blog.csdn.net/article/details/…

软件工程师,OpenAI Sora驾到,快来围观

概述 近期&#xff0c;OpenAI在其官方网站上公布了Sora文生视频模型的详细信息&#xff0c;展示了其令人印象深刻的能力&#xff0c;包括根据文本输入快速生成长达一分钟的高清视频。Sora的强大之处在于其能够根据文本描述&#xff0c;生成长达60秒的视频&#xff0c;其中包含&…

字符串拼接 - 华为OD统一考试(C卷)

OD统一考试&#xff08;C卷&#xff09; 分值&#xff1a; 200分 题解&#xff1a; Java / Python / C 题目描述 给定 M 个字符( a-z ) &#xff0c;从中取出任意字符(每个字符只能用一次)拼接成长度为 N 的字符串&#xff0c;要求相同的字符不能相邻。 计算出给定的字符列表…

平时积累的FPGA知识点(10)

平时在FPGA群聊等积累的FPGA知识点&#xff0c;第10期&#xff1a; 41 ZYNQ系列芯片的PL中使用PS端送过来的时钟&#xff0c;这些时钟名字是自动生成的吗&#xff1f; 解释&#xff1a;是的。PS端设置的是ps_clk&#xff0c;用report_clocks查出来的时钟名变成了clk_fpga_0&a…

JavaScript设计模式与开发实战

JavaScript设计模式与开发实践 第一章、面向对象的JavaScript 1.1 多态 类似java面向对象&#xff0c;通过继承共有特征&#xff0c;来实现不同方法。JavaScript的多态就是把“做什么”和“谁去做”分离&#xff0c;消除类型间的耦合关系。 他的作用就是把过程化的条件分支…

解决LeetCode编译器报错的技巧:正确处理位操作中的数据类型

一天我在leetcode上刷题时&#xff0c;遇到了这样的题目&#xff1a; 随即我写了如下的代码&#xff1a; int convertInteger(int A, int B) {int count 0;int C A ^ B;int flag 1;while(flag){if (C & flag){count;}flag<<1;}return count;} 但LeetCode显示如下…

07-k8s中secret资源02-玩转secret

一、回顾secret资源的简单实用 第一步&#xff1a;将想要的数据信息【key&#xff1a;value】中的value值&#xff0c;使用base64编码后&#xff0c;写入secret资源清单中&#xff1b; 第二步&#xff1a;创建secret资源&#xff1b; 第三步&#xff1a;pod资源引用secret资源&…

建造者模式-Builder Pattern

原文地址:https://jaune162.blog/design-pattern/builder-pattern/ 引言 现在一般大型的业务系统中的消息通知的形式都会有多种,比如短信、站内信、钉钉通知、邮箱等形式。虽然信息内容相同,但是展现形式缺不同。如短信使用的是纯文本的形式,钉钉使用的一般是Markdown的形…

【研究生复试】计算机软件工程人工智能研究生复试——资料整理(速记版)——JAVA

1、JAVA 2、计算机网络 3、计算机体系结构 4、数据库 5、计算机租场原理 6、软件工程 7、大数据 8、英文 自我介绍 1. Java 1. 和 equals的区别 比较基本数据类型是比较的值&#xff0c;引用数据类型是比较两个是不是同一个对象&#xff0c;也就是引用是否指向同 一个对象&…

C#,计算几何,贝塞耳插值(Bessel‘s interpolation)的算法与源代码

Friedrich Wilhelm Bessel 1 贝塞耳插值&#xff08;Bessels interpolation&#xff09; 首先要区别于另外一个读音接近的插值算法&#xff1a;贝塞尔插值&#xff08;Bzier&#xff09;。 &#xff08;1&#xff09;读音接近&#xff0c;但不是一个人&#xff1b; &#x…