---
# System prepended metadata

title: php 安裝小筆記

---

php 安裝小筆記
===

安裝
```
yum-config-manager --enable remi-php73
yum install yum-utils –y
yum install epel-release –y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

sudo yum-config-manager --enable remi-php73
yum install php php73-php-fpm php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql –y
```
在nginx的conf 修改php-fpm 配置
```
user = nginx
group = nginx

#listen = /var/run/php-fpm/php-fpm.sock
listen = 127.0.0.1:9000

listen.owner = nginx
listen.group = nginx
```
安裝swoole
```
yum install -y openssl-devel make autoconfi gcc gcc-c++ php-devel php-pear
pecl install swoole
```
找到php的設定檔位址
```
php --ini
```
找到 Loaded Configuration File, 寫入
```
extension=swoole.so
```
驗證安裝結果
```
php -m | grep swoole
php -i | grep swoole
```
找到 php-fpm service 名稱
```
systemctl | grep fpm
```
启动php-fpm 和nginx
```
systemctl enable php73-php-fpm
systemctl restart php73-php-fpm
systemctl restart nginx
```