PHP 安装配置(mac系统)

PHP 安装配置

如果没有brew 命令//command not find brew
 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)
提示 curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused 情况
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" 使用国内的资源

1.安装php

   brew install php ()
   brew upgrade php
  安装路径:/usr/local/Cellar/php/xxx
             /usr/local/etc/php/xxx

2.复制php配置在自己想要的路径 (/Users/xxx/shell/conf/php/xxx 为例)

cp -R /usr/local/etc/php/xxx /Users/xxx/shell/conf/php/xxx

3.查找php配置文件的位置

php --ini

4.自己复制完后的配置文件为

/usr/local/etc/php/xxx/php.ini   ----> /Users/xxx/shell/conf/php/xxx/php.ini

5.修改复制路径下的php.ini(/Users/xxx/shell/conf/php/xxx/php.ini)

date.timezone = "Asia/Ho_Chi_Minh"
mail.add_x_header = Off (7.2.11默认值)
;track_errors = Off (7.1的时候是开启的)
short_open_tag = On (7.2.11已默认开启)
always_populate_raw_post_data = -1
;extension_dir = "/usr/local/Cellar/php/xxx/pecl/xxxxxx” 这个貌似没效果最终改为
extension =/usr/local/Cellar/php/xxxx/pecl/xxxxxx/memcached.so"

6.测试php-fpm配置

  /usr/local/Cellar/php/xxx/sbin/php-fpm -t
  /usr/local/Cellar/php/xxx/sbin/php-fpm -c ~/shell/conf/php/xxx/php.ini -y ~/shell/conf/php/xxx/php-fpm.conf -t

7.修改php-fpm.conf(/Users/wxy/shell/conf/php/xxx)

pid = /Users/ygh/tmp/php-fpm.pid
error_log = /Users/wxy/tmp/php-fpm.log
daemonize = yes
include=/Users/wxy/shell/conf/php/7.3/php-fpm.d/*.conf

8.修改php-fpm.d/www.conf(/Users/wxy/shell/conf/php/xxx)

vi ~/shell/conf/php/xxx/php-fpm.d/www.conf
;user = wxy #只适用于之前php72 start|stop这样的方式
;group = staff
listen = 127.0.0.1:9090

9.配置快速启动和停止sh 文件

9.1 启动 可创建~/shell/php.start.sh 
/usr/local/Cellar/php/xxx/sbin/php-fpm -c ~/shell/conf/php/xxx/php.ini -y ~/shell/conf/php/xxx/php-fpm.conf
9.2 停止,可创建~/shell/php.stop.sh
kill -INT `cat ~/tmp/php-fpm.pid`

9.3 配置在系统环境中,创建快捷命令
vi ~/.bash_profile 
alias php.start='sh ~/shell/php.start.sh' 
alias php.stop='sh ~/shell/php.stop.sh' 
source ~/.bash_profile

9.4 快捷命令使用
启动:php.start
停止:php.stop
重启:kill -USR2 `cat /Users/wxy/tmp/php-fpm.pid`

10.查看php-fpm是否在运行

ps -ef | grep php

11.查看php-fpm的位置

whereis php-fpm
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值