ApacheServer (PHP + MySQL) onRaspberryPI Apache
Raspberry PI origins from UK. it is a small (credit-card size) fully functional PC that installlinux. to now, there are two models A and B of Raspberry PI. the A model has 1 USB, 256 mb ram and The enhanced B model has 2 USB, 512 RAM. both are equipped with ARM 700 MHz (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 (5 V, 1A) and it doesn' t have the power switch. it can be connected to monitor using HDMI or TV using composite video (RCA ).
The SD card is used as the booting device 'hard drive ', a minimal 4 GB is required. you can download Linux images fromofficial website. and you can use Win32 Disk Imager to write *. img to SD card.
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.
Run the following command to install Apache2 and PHP,
|
sudo apt-get install apache2 php5 libapache2-mod-php5 |
sudo apt-get install apache2 php5 libapache2-mod-php5
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 |
sudo apt-get install mysql-server mysql-client php5-mysql
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.
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 |
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
The apache server will storeIndex.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.
-EOF-
GD Star Rating
Loading...
GD Star Rating
Loading...