Set up Single File PHP Gallery

Configuration Files

we will start by editing the lighttpd.conf file.

nano /opt/piratebox/conf/lighttpd/lighttpd.conf

scroll down the file untill you come to this line:

static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" , ".cgi" , ".py" )

remove php to look like this:

static-file.exclude-extensions = ( ".pl", ".fcgi" , ".cgi" , ".py" )

Scroll to the bottom and add these set of lines:

$HTTP["url"] =~ "^/gallery/" { 
cgi.assign = ( ".php" => "/usr/bin/php-cgi" , ) 
}

save and exit.

next we will edit the php.ini file:

sudo nano /etc/php/php.ini

and uncomment this line be removing the colon ';':

;extension=gd.so

save and exit.

create the gallery directory and set permissions:

sudo mkdir /opt/piratebox/share/gallery
sudo chown alarm:alarm /opt/piratebox/share/gallery
sudo chmod 775 /opt/piratebox/share/gallery
sudo mkdir /opt/piratebox/share/gallery/_sfpg_data
sudo chown nobody:nogroup /opt/piratebox/share/gallery/_sfpg_data
sudo chmod 755 /opt/piratebox/share/gallery/_sfpg_data

Point your web browser to Single File PHP Library and download the latest version.
Unzip the index.php file somewhere on your computer.

Now we need to connect our computer to the PirateBox AP
Once connected, log in via sftp with an ftp client such as FileZilla

Login information is the same as your SSH login ex.
Host: 192.168.77.1
User: alarm
Pass: *your password*
Port: 22

Now browse to your gallery directory we created: .. → .. → opt → piratebox → share → gallery

Upload your index.php file and any images you would like.
Disconnect.

Reboot your piratebox to set all the changes.
Once loaded, browse to http://piratebox.lan/gallery to see if it works.