前言
MacOS可以使用launchctl
命令管理服务,也可以使用brew services
。
brew services 相比 launchctl,操作更简化,更加类似 Centos 的 systemd 命令。
brew services常用命令
启动、停止服务
例如:启动nginx
brew services start nginx
例如:停止php-fpm
brew services stop php
MacOS可以使用launchctl
命令管理服务,也可以使用brew services
。
brew services 相比 launchctl,操作更简化,更加类似 Centos 的 systemd 命令。
例如:启动nginx
brew services start nginx
例如:停止php-fpm
brew services stop php
直接使用brew命令安装即可
brew install php
安装指定版本
brew install php@7.2
MacOS下使用pecl安装PHP扩展
查看pecl
pecl version
$key = ftok(__FILE__, 'a');
$queue = msg_get_queue($key);
$pidList = [];
$socketList = [];
for ($i = 1; $i <= 2; $i++) {
$taskPid = pcntl_fork();
if ($taskPid == -1) {
die("[父进程]child{$i}创建失败");
} elseif ($taskPid) {
$pidList[$i] = $taskPid;
echo "[父进程]child{$i}创建成功,子进程ID:{$taskPid}". PHP_EOL;
} else {
//子进程
while (true) {
msg_receive($queue, 1, $type, 1024, $msg);
if ($msg) {
echo "[子进程@child{$i}]收到消息:{$msg}";
}
usleep(50);
}
}
}
//父进程循环
while (true) {
msg_send($queue, 1, ['from'=>'father','text'=>"Hi child,I'm father."]);
sleep(3);
}
yum instlal make gcc
进入/tmp目录,然后执行下载命令
wget https://github.com/beanstalkd/beanstalkd/archive/v1.12.zip
解压下载的文件
unzip v1.12.zip
若要更新到 WSL 2,需要 Windows 10 或 Windows 11。
前提:BOIS开启了CPU虚拟化支持
打开windows设置 -> 应用和功能 -> 可选功能 -> 更多Windows功能
将Hyper-V
、虚拟机平台
、适用于Linux的Windows 子系统
选项全部勾上
开始菜单 -> PowerShell -> 单击右键 -> 以管理员身份运行
然后输入以下命令:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart