自从老早入手了树莓派
为了省事直接apt-get install php
默认安装的php5,已经非常落后了
平时在树莓派上主要用python脚本和shell脚本
这两天看看能不能安装php7,这样可以跑起laravel框架
`apt-get install php7.2` 报错Unable to locate package php7.2
首先添加源
```
apt install ca-certificates apt-transport-https -y
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list
apt update
```
接着安装php7.2及相关的扩展
```
sudo apt-get install php7.2
sudo apt-get install php7.2-fpm php7.2-mysql php7.2-curl php7.2-json php7.2-mbstring php7.2-xml php7.2-intl php7.2-gd
```
安装nginx
```
apt-get install nginx
```
配置nginx配置文件
cat /etc/nginx/sites-available/default
```
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
}
```
即可
因为配置太低,所有就没有安装composer
而是直接将一个laravel项目上传到树莓派中
![](https://www.yuanchengzhushou.cn/static/image/8159.jpg)
参考文章
`https://www.jianshu.com/p/79c576e16dae`