Skip to content

Commit

Permalink
Create Post
Browse files Browse the repository at this point in the history
  • Loading branch information
mowangjuanzi committed Jan 21, 2025
1 parent eed121a commit 0c9102c
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,32 @@ export default defineConfig({
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: "PHP 基金会", link: "/php-foundation"}
{ text: "PHP 基金会", link: "/php-foundation" },
{ text: "博客", link: "/blog" },
],

sidebar: [
{
sidebar: {
"/php-foundation": {
text: "PHP 基金会",
link: "/php-foundation",
items: [
{text: "PHP 基金会祝您节日快乐!", link: "/php-foundation/2024-12-23-happy-holidays-from-the-php-foundation.md"},
{text: "PHP 基金会支持开源承诺", link: "/php-foundation/open-source-pledge.md"},
{text: "PHP 核心综述 #19", link: "/php-foundation/php-core-roundup-19.md"}
]
},
"/blog": {
text: "博客",
link: "/blog",
items: [
{ text: "Ubuntu 安装 PHP", link: "/blog/ubuntu-apt-php.md" },
]
}
],
},

footer: {
message: '<a href="https://beian.miit.gov.cn/">鲁ICP备13027795号-1</a>',
copyright: 'Copyright © 2015-2023 魔王卷子'
copyright: 'Copyright © 2015-2025 魔王卷子'
},

socialLinks: [
Expand Down
1 change: 1 addition & 0 deletions blog/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 博客
92 changes: 92 additions & 0 deletions blog/ubuntu-apt-php.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Ubuntu 安装 PHP

本文章用于阿里云等云服务器的配置使用。

## 安装

安装源

```bash
sudo add-apt-repository ppa:ondrej/php
```

安装 PHP

```bash
sudo apt install php8.4-fpm php8.4-mbstring php8.4-mysql php8.4-gd php8.4-curl php8.4-zip
```

## 管理 PHP

```bash
# 查看状态
sudo systemctl status php8.4-fpm

# 启动
sudo systemctl start php8.4-fpm

# 重启
sudo systemctl restart php8.4-fpm

# 设置开机启动(默认已开启)
sudo systemctl enable php8.4-fpm

# 取消开机启动
sudo systemctl disable php8.4-fpm

## 自行编译扩展

安装编译扩展所必须的文件

```bash
sudo apt install php8.4-dev
```

传统的编译扩展方式:

```bash
sudo pecl install seaslog
```

最新版的扩展安装方式是 PIE。

官方文档:https://github.com/php/pie

## Composer

安装

```bash
sudo curl -o /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar
sudo chmod +x /usr/local/bin/composer
```

## 相关路径

| 英文名称 | 路径 | 说明 |
|:---:|:---:|:---:|
| config | /etc/php/8.4 | 配置文件路径 |
| log | /var/log/php8.4-fpm.log | FPM 日志 |

## 配置

编辑 `/etc/php/8.4/fpm/pool.d/www.conf`

里面主要是修改三个配置:

```ini
user = www-data
group = www-data
```

这里主要是指定运行 FPM worker 的用户和用户组。我比较喜欢用 `www-data`

```ini
listen = 127.0.0.1:900
```

listen 监听的方式,有端口和 unix 域两种,我喜欢修改为端口的方式。

# 结尾

以上就是我一些常在服务器上进行配置的相关命令。

0 comments on commit 0c9102c

Please sign in to comment.