sudo vim /etc/apt/sources.list
将内容改成下面这样
#deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspbian.org/raspbian/ wheezy main contrib non-free rpi
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ jessie main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ jessie main non-free contrib
然后 sudo apt-get update
然后 sudo apt-get install php5 php5-fpm php5-cli
然后 php -v
看看是不是装好了5.6
别忘了安装pdo sudo apt-get install php5-mysqlnd php5-sqlite php-db
然后nginx配置成:
http {
server {
listen 80;
root /www;
location / {
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
然后 sudo service nginx restart && sudo service php5-fpm restart
然后curl localhost
看看
搞定!
参考:https://snippets.khromov.se/php-5-5-on-raspbian-raspberry-pi/