搭建Raspberry Pi上的LAMP环境
以下是準備在Raspberry Pi上配置LAMP環境的備忘錄。
在撰写本文时,使用的RaspberryPi OS版本如下。
树莓派:~ $ lsb_release -a
没有可用的LSB模块。
分发者标识: Raspbian
描述: Raspbian GNU/Linux 10 (buster)
版本: 10
代号: buster
树莓派:~ $
参考页面如下:
非常感谢。
实际上,这只是模仿前辈页面的帖子。
http://marchan.e5.valueserver.jp/cabin/comp/jbox/arc112/doc11205.html
安装Apache2和PHP。
安装Apache2。
请更新sudo apt
请安装sudo apt apache2
我们将安装PHP。
使用sudo apt安装php、php-cli和php-curl。
为了在userdir中使用php,我们需要对apache2进行配置。
使用sudo命令启用userdir模块
由于用户目录的php在下一个文件中被停用,因此将其注释掉。
sudo vi /etc/apache2/mods-enabled/php7.3.conf
php_admin_flag engine Off
请以本地中文语言重新表达以下内容。
sudo vi /etc/apache2/mods-enabled/php7.3.conf
##
##
## php_admin_flag engine Off
##
##
重新启动Apache2以使更改生效。
请重启Apache2:`sudo systemctl restart apache2`
为了确认,我会写一个.php的文件。
pi@raspberrypi在~/public_html目录下创建了一个index.php文件,并输入以下内容: