README file for PHP Shell 2.1 Copyright (C) 2000-2005 Martin Geisler Licensed under the GNU GPL. See the file COPYING for details. What is PHP Shell? ================== PHP Shell is a shell wrapped in a PHP script. It's a tool you can use to execute arbitrary shell-commands or browse the filesystem on your remote webserver. This replaces, to a degree, a normal telnet-connection. You use it for administration and maintenance of your website, which is often much easier to do if you can work directly on the server. For example, you could use PHP Shell to unpack and move big files around. All the normal command line programs like ps, free, du, df, etc... can be used. Limitations =========== There are some limitations on what kind of programs you can run. It won't do no good if you start a graphical program like Firefox or even a console based one like vi. All programs have to be strictly command line programs, and they will have no chance of getting user input after they have been lunched. They probably also have to terminate within 30 seconds, as this is the default time-limit imposed unto all PHP scripts, to prevent them from running in an infinite loop. Your ISP may have set this time-limit to something else. But you can rely on all the normal shell-functionality, like pipes, output and input redirection, etc... (There is no -completion, though :-) Safe Mode ========= Safe Mode is the nemisis of PHP Shell. If PHP is running in Safe Mode then PHP Shell will normally not work --- sorry. Please read the detailed explaination in the SECURITY file. Who am I? ========= (Well, my name is Martin, but that's not the point :-) You may not be the same user when using PHP Shell, as you are when you upload your files with FTP. On some systems you will be ``nobody``, on other systems you will become ``httpd`` or ``www-data``. This is a rather dangerous "feature" of the way PHP is run by the webserver. A possible effect of this is that you might end up creating files using PHP Shell which you cannot delete afterwards using FTP and maybe not even using PHP Shell. Strange, but true :-) If you want to execute code as different user, then it's possible to do so by using the Sudo program available from this address: http://www.courtesan.com/sudo/ The trick is to configure Sudo to allow the user running the webserver to execute certain commands as a more privileged user. This will have to be done by the administrator of the server. Please refer to the documentation for Sudo for further information about doing this. How to Use It ============= When you point your browser at PHP Shell you will be asked to authenticate yourself. By default no username/password will work, so please go read INSTALL for information about adding a user. You're back? Good. Enter your username and password and press "Login". You will then be presented with a rather simple page containing nothing much except a big window with the cursor blinking at the bottom, signaling that it's ready to obey your commands. Write a command and press RET --- or alternatively, press the 'Execute Command' button if you really want. The command will be executed and the result will be shows in the terminal. You can now enter another command. To be more precise: the terminal is updated with the command line you have just executed, the output of the command to standard out (stdout), and following that any error output sent to stderr. The commands are executed relative to a current working directory, which is written at the top. You change this by the normal 'cd' command. Download ======== You can download the newest version of PHP Shell from http://mgeisler.net/php-shell/ The tarball/zipfile contains these files: phpshell.php This is the script you run when you use PHP Shell. ChangeLog This file describe the changes I've made to PHP Shell. By reading it you'll always know when I've added a new feature or made a bugfix, and the nature of the feature/bugfix. README This file! :-) INSTALL Tells you how to install PHP Shell. Amoung other things, it explains how to change the password protection so that you can use PHP Shell. Remember that it's very important to have PHP Shell password protected, or else everybody will be able so snoop into your files and perhaps also be able to delete them! Please take the time to protect your installation of PHP Shell. SECURITY A separate guide about security with PHP in general and PHP Shell in particular. Be sure to read this too, especially if you are getting strange errors back from PHP Shell. COPYING Standard GNU GPL.