Install mysql php5 and phpmyadmin on raspberry pi

Install PHP

sudo apt-get install php5-cgi

Edit php.ini file
sudo nano /etc/php5/cgi/php.ini

Scroll the bottom and add
cgi.fix_pathinfo = 1

save and exit

Enable fast CGI
sudo lighty-enable-mod fastcgi-php

Restart lighttpd
sudo /etc/init.d/lighttpd restart

Create phpinfo page
sudo nano /var/www/phpinfo.php

and add the following
<?php phpinfo();?>

Save and exit

Enter Pi ip addres into a browser followed by phpinfo.php
http://192.168.1.x/phpinfo.php

Install MySQL and PHPMYADMIN

sudo apt-get install mysql-server mysql-client phpmyadmin

mysql root password, confirm

During the installation of PHPMyAdmin you will be asked which web server is installed. Choose lighttpd.

A message will appear asking whether you want to create a dummy database. As the message states, if you know what you are going to be using the database server for or a database is already configured then you can answer no but if you are just experimenting then you can answer yes.

I recommend answering yes to this. It doesn’t do any harm.

Continue Reading

Install lighttpd webserver on raspberry pi

This quick guide will walk you through installing the lighttpd webserver on a raspberry Pi.

Update packages
sudo apt-get update

Install lighttpd
sudo apt-get install lighttpd

Once completed enter your pi’s ip address in a browser and if all has gone well your should see the holding page.

Now we will adjust some permissions to ensure the “Pi” user account can write files to the location where Lighttpd expects to find web pages. The /var/www directory is currently owned by the “root” user. So let’s make the “www-data” user and group the owner of the /var/www directory.
sudo chown -R www-data:www-data /var/www

Allow the “www-data” group permission to write to /var/www
sudo chmod 775 /var/www

Add the “Pi” user to the “www-data” group.
sudo usermod -a -G www-data pi

For permissions to take effect reboot te Pi
sudo reboot

Continue Reading