一、安装
1、更新
apt-get update
2、解决语言冲突和中文乱码
apt-get install language-pack-en-base software-properties-common -y
3、语言环境
locale-gen en_US.UTF-8
4、安装vim
apt-get install vim -y
5、使用ppa安装php
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
6、再次更新
apt-get update
7、安装php
apt-get install php7.4
8、查看php版本
php -v
9、安装相关组件
apt-get install php7.4-fpm php7.4-cli php7.4-dev php7.4-redis php7.4-mysql php7.4-curl php7.4-xml php7.4-json php7.4-gd php7.4-mbstring php7.4-zip php7.4-bcmath -y
10、查看组件
php -m
注意事项
su root根据提示输入密码,切换权限
中间需要选择时区6亚洲和70上海
添加ppa的时候需要回车
二、创建自动脚本
installphp.sh
apt-get update
apt-get install language-pack-en-base unzip zip composer -y
locale-gen en_US.UTF-8
apt-get install software-properties-common -y
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.4 php7.4-fpm php7.4-cli php7.4-dev php7.4-redis php7.4-mysql php7.4-curl php7.4-xml php7.4-json php7.4-gd php7.4-mbstring php7.4-zip php7.4-bcmath -y
php -v