网站首页 > 资源文章 正文
因项目需求,在树莓派上折腾了LAMP环境,安装过程中遇到一些问题,慢慢折腾解决了。
1、更换系统源
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 rpi
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpi
2、更新系统
sudo apt-get update -y
3、安装Apache与php7.3
更新完,安装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 rpi
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib rpi
#添加源 安装php7.3
deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi
deb-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扩展成功
- 上一篇: 使用树莓派做两轮自平衡车(二)——获取角度
- 下一篇: 6步傻瓜式点击在树莓派上安好Win11
猜你喜欢
- 2024-11-23 Raspberry Pi OS现上线64位镜像版本
- 2024-11-23 树莓派官方保护壳问世:小巧别致
- 2024-11-23 打造基于树莓派的实时系统
- 2024-11-23 乌班图MATE 16.04 LTS发布 支持树莓派
- 2024-11-23 机器人梦系列-树莓派资源整理汇总
- 2024-11-23 要不要入手?5美元计算机 适于编程!
- 2024-11-23 使用树莓派让老打印机也能网络打印
- 2024-11-23 CrowPi2树莓派4学习套件评测第1部分–开箱和首次启动
- 2024-11-23 6步傻瓜式点击在树莓派上安好Win11
- 2024-11-23 使用树莓派做两轮自平衡车(二)——获取角度
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 电脑显示器花屏 (79)
- 403 forbidden (65)
- linux怎么查看系统版本 (54)
- 补码运算 (63)
- 缓存服务器 (61)
- 定时重启 (59)
- plsql developer (73)
- 对话框打开时命令无法执行 (61)
- excel数据透视表 (72)
- oracle认证 (56)
- 网页不能复制 (84)
- photoshop外挂滤镜 (58)
- 网页无法复制粘贴 (55)
- vmware workstation 7 1 3 (78)
- jdk 64位下载 (65)
- phpstudy 2013 (66)
- 卡通形象生成 (55)
- psd模板免费下载 (67)
- shift (58)
- localhost打不开 (58)
- 检测代理服务器设置 (55)
- frequency (66)
- indesign教程 (55)
- 运行命令大全 (61)
- ping exe (64)
本文暂时没有评论,来添加一个吧(●'◡'●)