centos自动化脚本安装PHP7.1
时间: 2023-07-24 09:07:07 浏览: 57
可以使用以下脚本安装 PHP 7.1:
```
#!/bin/bash
# 安装必要的软件包
yum install epel-release -y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
yum install yum-utils -y
yum-config-manager --enable remi-php71
# 安装 PHP 7.1
yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql -y
# 启动 PHP-FPM 服务
systemctl start php-fpm
systemctl enable php-fpm
```
这个脚本会添加 Remi 存储库,并使用 yum 安装 PHP 7.1。最后,它会启动 PHP-FPM 服务,并设置为自动启动。
相关问题
centos自动化安装PHP5.6脚本
以下是一个基本的自动化安装PHP 5.6的脚本:
```bash
#!/bin/bash
# 安装 EPEL 和 Remi 存储库
yum install -y epel-release yum-utils
yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
# 启用 Remi 存储库
yum-config-manager --enable remi-php56
# 安装 PHP 5.6 和常用扩展
yum install -y php php-cli php-fpm php-mysql php-gd php-xml php-mbstring php-zip
# 启动 PHP-FPM
systemctl start php-fpm
# 设置 PHP-FPM 开机自启动
systemctl enable php-fpm
```
这个脚本做了以下几件事情:
1. 安装 EPEL 和 Remi 存储库,这些存储库包含了 PHP 5.6 的软件包。
2. 启用 Remi 存储库。
3. 使用 yum 安装 PHP 5.6 和常用扩展。
4. 启动 PHP-FPM。
5. 设置 PHP-FPM 开机自启动。
你可以将这个脚本保存为 `install-php56.sh`,然后通过以下命令运行:
```bash
bash install-php56.sh
```
请注意,这个脚本只适用于 CentOS 7。如果你使用的是其他版本的 CentOS 或其他 Linux 发行版,请自行修改相应的命令和软件包名称。
centos 7.3安装PHP7.1
在CentOS 7.3上安装PHP 7.1的步骤如下:
1. 添加EPEL和Remi存储库:
```shell
sudo yum install epel-release
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
```
2. 启用Remi存储库:
```shell
sudo yum-config-manager --enable remi-php71
```
3. 安装PHP 7.1及其常用扩展:
```shell
sudo yum install php php-cli php-fpm php-mysql php-bcmath php-gd php-mcrypt php-mbstring php-odbc php-xml
```
4. 验证PHP版本:
```shell
php -v
```
你将看到类似以下输出:
```
PHP 7.1.6 (cli) (built: Jun 25 2017 13:42:29) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.6, Copyright (c) 1999-2017, by Zend Technologies
```
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![sh](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)