PHP Shell

From Alpine Linux
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

PHP Shell is an interface to execute shell-commands or browse the filesystem on your remote web server.

Install lighttpd, PHP, and MySql

Basic Installation

For installing the additional packages first activate community packages and update the package index

Install the required packages:

# apk add lighttpd php82 fcgi php82-cgi

Configure Lighttpd

Edit lighttpd.conf (/etc/lighttpd/lighttpd.conf) and uncomment the line:

Contents of /etc/lighttpd/lighttpd.conf

... include "mod_fastcgi.conf" ...

Edit mod_fastcgi.conf (/etc/lighttpd/mod_fastcgi.conf), find and change /usr/bin/php-cgi to /usr/bin/php-cgi82.

Contents of /etc/lighttpd/mod_fastcgi.conf

... "bin-path" => "/usr/bin/php-cgi82" # php-cgi ...

Start lighttpd service and add it to default runlevel

# rc-service lighttpd start # rc-update add lighttpd default

Installing and configuring PHP Shell

Create the a folder named webapps

mkdir -p /usr/share/webapps/

Download the source code

cd /usr/share/webapps/ wget https://downloads.sourceforge.net/project/phpshell/phpshell/2.4/phpshell-2.4.zip

Unpack the archive, rename the created folder, and remove it afterwards

unzip phpshell-2.4.zip mv phpshell-2.4/ phpshell rm phpshell-2.4.zip

Change the folder permissions

chmod -R 777 /usr/share/webapps/

Make a symlinks to the phpshell folder

ln -s /usr/share/webapps/phpshell/ /var/www/localhost/htdocs/phpshell

Configuration of PHP Shell

Browse to http://WEBSERVER_IP_ADDRESS/phpshell/pwhash.php and generate a hashed password for your username.

 fabian = "sha1:1c53656:0ffc35a857573c3b45eb0a6d9fdfc29d59b94306"

Add this to the config.php

nano -w config.php

Now you should be able to login at http://WEBSERVER_IP_ADDRESS/phpshell/phpshell.php