注释掉系统默认源,改换阿里云源。
#deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi#Uncomment line below then 'apt-get update' to enable 'apt-get source'#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpideb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpideb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpi
sudo apt-get update -y

更新完,安装Apache。
sudo apt-get install apache2 -y
安装php7.3须要添加其他更新源
sudo nano /etc/apt/sources.list
# deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi# Uncomment line below then 'apt-get update' to enable 'apt-get source'# deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpideb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpideb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpi#添加源 安装php7.3deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpideb-src http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi
sudo apt install -y -t buster php7.3-fpm php7.3-curl php7.3-gd php7.3-intl php7.3-mbstring php7.3-mysql php7.3-imap php7.3-opcache php7.3-sqlite3 php7.3-xml php7.3-xmlrpc php7.3-zip
由于在安装7.3之前有7.1版本,并且apahce在php7.3之前安装的,以是导致解析不了php。办理方法是安装 libapache2-mod-php7.3
sudo apt-get install libapache2-mod-php7.3
安装完成php解析正常
由于项目须要用到redis,但是安装php的时候没有安装redis扩展,以是须要重新安装。由于并不需太多设置,以是就不编译安装,直策应用apt安装。
先安装redis
sudo apt-get install redis-server -y
redis 安装完往后,还须要php加载redis扩展,以是须要安装php-redis,搜索一下
sudo apt search php-redis
这里涌现两个版本 我安装的是php-redis 相对较新的版本。
sudo apt-get install php-redis
redis安装完后重启apache做事测试一下。
sudo service apache2 restart
测试一下php-redis是否扩展成功
sudo nano /var/www/html/redis.php
浏览器输入http://ip/redis.php 我这里输入http://192.168.0.103/redis.php
redis扩展成功