最後更新: 2019-04-16
目錄
- 用 remi 安 PHP
- Centos 7 Enable remi
- Centos 6 Enable remi
- remi-safe Usage
- Install PHP Example
用 remi 安 PHP
remi-safe 的包安裝在 /opt/remi/phpX
e.g.
/opt/remi/php73/
Centos 7 Enable remi
yum install epel-release
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils # 獲得 yum-config-manager
# Single version (simplest way): remi-php73 repository
yum-config-manager --enable remi-php73
# Multiple versions simultaneously: remi-safe repository (enabled by default)
yum-config-manager --disable remi-safe
# Disable 其他不會用到的 Version ("yum list | grep ^php" 小許多)
yum-config-manager --disable remi-php71
yum-config-manager --disable remi-php72
yum-config-manager --disable remi-php74
# 用了 yum-config-manager 就不用 "--enablerepo=remi-php73"
yum --enablerepo=remi-php73 install \ php73-php-fpm php73-php-process \ php73-php-recode php73-php-intl php73-php-tidy php73-php-mbstring \ php73-php-mysqlnd php73-php-pdo \ # DB php73-php-bcmath php73-php-geos \ # other php73-php-xml php73-php-json php73-php-pecl-yaml \ # format php73-php-gd php73-php-pecl-imagick \ # image php73-php-pear \ # php73-php-pecl-apcu \ # pear php73-php-lz4 php73-php-pecl-zip # zip
Remark: 安一堆包
xargs -a php-package.txt yum install
# Checking
Modules
php73 --modules
FPM
# Config: /etc/opt/remi/php73/php-fpm.conf
systemctl enable php73-php-fpm
systemctl restart php73-php-fpm
# 127.0.0.1:9000
systemctl status php73-php-fpm
Centos 6 Enable remi
Install epel-release
yum install yum-utils
yum install https://rpms.remirepo.net/enterprise/remi-release-6.rpm
remi-safe Usage
CLI
source /opt/remi/phpX/enable
Config Location
# php73 -i | grep php.ini
Configuration File (php.ini) Path => /etc/opt/remi/php73 Loaded Configuration File => /etc/opt/remi/php73/php.ini
Install PHP Example
# Install php56
yum install php56 php56-php-fpm php56-php-cli php56-php-opcache \ php56-php-mysqlnd php56-php-pdo php56-php-lz4 \ php56-php-mbstring php56-php-gd php56-php-bcmath \ php56-php-soap php56-php-json php56-php-xml \ php56-php-intl php56-php-pspell php56-php-tidy \ php56-php-pear php56-php-pecl-yaml php56-php-pecl-zip \ php56-php-pecl-mcrypt php56-php-pecl-crypto php56-php-pecl-apcu
# remi-safe 內的 php80
yum install php80 php80-php-fpm php80-php-cli php80-php-opcache \ php80-php-mysqlnd php80-php-pdo php80-libzip php80-php-lz4 \ php80-php-mbstring php80-php-gd php80-php-bcmath \ php80-php-soap php80-php-json php80-php-xml \ php80-php-intl php80-php-pspell php80-php-tidy \ php80-php-pear php80-php-pecl-yaml php80-php-pecl-zip \ php80-php-pecl-mcrypt php80-php-pecl-crypto php80-php-pecl-apcu yum install php80-php-pecl-imagick
# remi-safe 內的 php83
dnf install php83 php83-php-fpm php83-php-cli php83-php-opcache \ php83-php-mysqlnd php83-php-pdo \ php83-php-lz4 php83-php-xz php83-php-gd \ php83-php-mbstring php83-php-bcmath \ php83-php-soap php83-php-json php83-php-xml \ php83-php-intl php83-php-pspell php83-php-tidy \ php83-php-pear php83-php-pecl-yaml php83-php-pecl-zip \ php83-php-pecl-mcrypt php83-php-pecl-crypto php83-php-pecl-apcu dnf install php83-php-pecl-imagick
# dnf module switch-to php:remi-7.4 後的 php
yum install php-fpm php-cli php-opcache \ php-mysqlnd php-pdo libzip php-lz4 \ php-mbstring php-gd php-bcmath \ php-soap php-json php-xml \ php-intl php-pspell php-tidy \ php-pear php-pecl-yaml php-pecl-zip \ php-pecl-mcrypt php-pecl-crypto php-pecl-apcu
Rocky8 Enable REMI
rpm -Uvh remi-release-8.rpm
dnf config-manager --enable remi
R8 安 PHP7.4 GD 問題
php74 -m | grep -i gd
PHP Warning: PHP Startup: Unable to load dynamic library 'gd' (tried: /opt/remi/php74/root/usr/lib64/php/modules/gd (/opt/remi/php74/root/usr/lib64/php/modules/gd: cannot open shared object file: No such file or directory), /opt/remi/php74/root/usr/lib64/php/modules/gd.so (/lib64/libraqm.so.0: undefined symbol: hb_ft_font_set_load_flags)) in Unknown on line 0
dnf install harfbuzz
附加檔案 | 大小 |
---|---|
remi-release-7.rpm | 22.7 KB |
remi-release-8.rpm | 26.12 KB |
remi-release-9.rpm | 29.76 KB |