Apache Server (PHP + MySQL) on Raspberry PI_MySQL

WBOY
Lepaskan: 2016-06-01 13:14:43
asal
1146 orang telah melayarinya

Apache

Raspberry PI origins from UK. It is a small (credit-card size) fully functional PC that installs Linux. To now, there are two models A and B of Raspberry PI. The A model has 1 USB, 256MB RAM and The enhanced B model has 2 USB, 512 RAM. Both are equipped with ARM 700MHz (single core) CPU, a SD card slot. The B model also comes with an onboard Ethernet interface. The Raspberry PI requires a micro USB power (5V, 1A) and it doesn’t have the power switch. It can be connected to monitor using HDMI or TV using composite video (RCA).

Apache Server (PHP + MySQL) on Raspberry PI

The SD card is used as the booting device ‘hard drive’, a minimal 4GB is required. You can download Linux images fromofficial website. And you can use Win32 Disk Imager to write the *.img to SD card.

Win32 Disk Imager for Raspberry PI

Insert the SD card into Raspberry PI.

Insert the SD card into Raspberry PI.

Power it on and on the first time a configuration program (sudo raspi-config) will run. Using this configuration tool, you’ll be able to set up SSH, keyboard, Memory Split between CPU and GPU etc.

sudo raspi-config Raspberry PI.

SSH Raspberry PI.

Run the following command to install Apache2 and PHP,

sudo apt-get install apache2 php5 libapache2-mod-php5
Salin selepas log masuk
Salin selepas log masuk
sudo apt-get install apache2 php5 libapache2-mod-php5
Salin selepas log masuk
Salin selepas log masuk

And as we know, PHP without MySQL database is pretty much useless, so we use the following command to install MySQL.

sudo apt-get install mysql-server mysql-client php5-mysql
Salin selepas log masuk
Salin selepas log masuk
sudo apt-get install mysql-server mysql-client php5-mysql
Salin selepas log masuk
Salin selepas log masuk

During the MySQL setup, you will be prompted for the root password for MySQL database, and after that we’ll be able to check if MySQL is properly installed.

MySQL on Raspberry PI.

You can runsudo service mysql restartandsudo service apache restartto restart the MySQL and apache server manually. And you can runphp -vto see the version of PHP.

pi@raspberrypi:~$ php -vPHP 5.4.4-14+deb7u9 (cli) (built: Apr 26 2014 21:57:41) Copyright (c) 1997-2012 The PHP GroupZend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Salin selepas log masuk
Salin selepas log masuk
pi@raspberrypi:~$ php -vPHP 5.4.4-14+deb7u9 (cli) (built: Apr 26 2014 21:57:41) Copyright (c) 1997-2012 The PHP GroupZend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Salin selepas log masuk
Salin selepas log masuk

The apache server will store aindex.htmlby default on/var/www/index.htmland if you open a browser and type in the IP address of the Raspberry PI, you will get something like this, which means your Raspberry PI now serves as a HTTP server.

Apache Server on Raspberry PI.

–EOF–

GD Star Rating
loading...

GD Star Rating
loading...

sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan