What is PHPSandbox?
A PHP-based sandboxing library with a full suite of configuration and validation options. -https://github.com/Corveda/PHPSandbox
- Log into the Debian device
- Run the following commands in a terminal:
# update repositories
sudo apt update
# install any available software updates
sudo apt upgrade -y
# install some dependencies
sudo apt install git composer apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
# install Apache HTTPD and PHP components
sudo apt install apache2 php7.3 libapache2-mod-php7.3 php-imagick php-gnupg php7.3-common php7.3-mysql php7.3-fpm php7.3-ldap php7.3-gd php7.3-imap php7.3-json php7.3-curl php7.3-zip php7.3-xml php7.3-mbstring php7.3-bz2 php7.3-intl php7.3-gmp php7.3-xsl -y
# change directory
cd /var/www
# clone php sandbox from github
sudo git clone https://github.com/Corveda/PHPSandbox.git
# rename PHPSandbox to phpsandbox
sudo mv ./PHPSandbox ./phpsandbox
# set the owner of the phpsandbox directory to www-data
sudo chown -R www-data:www-data /var/www/phpsandbox
# setup composer working directory
sudo mkdir /var/www/.composer
sudo chown -R www-data:www-data /var/www/.composer
# change directory
cd phpsandbox
# install dependencies with composer
sudo -u www-data composer install
# create and edit phpsandbox.conf
sudo nano /etc/apache2/sites-available/phpsandbox.conf - Paste the following into phpsandbox.conf
Alias /phpsandbox "/var/www/phpsandbox/toolkit/"
<directory /var/www/phpsandbox/toolkit/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</directory> - Press CTRL+O, Enter, CTRL+X to write the changes to phpsandbox.conf
- Continue with the following commands
# enable the phpsandbox site
sudo a2ensite phpsandbox
# restart apache2
sudo systemctl restart apache2 - Open a web browser and navigate to http://DNSorIP/phpsandbox
- Welcome to your very own self-hosted PHP Sandbox