Interactive PHP Shell (one line of PHP)

digital-ether 0 Tallied Votes 269 Views Share

Just copy and paste the snippet into a file and save.

You need to save this under the web root, not in a web accessible folder. For example, on linux you could save it in your home directory. Say your user is "joe" then save it in /home/joe/ . Ify saved the file as interactive.php then you would invoke it via the command line with: ./interactive.php

More information is at: http://onwebdevelopment.blogspot.com/2008/03/php-interactive-shell.html

#!/usr/bin/php
<?php while (1) {  fputs(STDOUT, "\n\-PHP$ "); eval(trim(fgets(STDIN))); } ?>