<?php $shellCommand = "grep 'mytext' * -R"; echo shell_exec($shellCommand); ?>
PHP grep search without console access
With some cPanel setups, no SSH or console access is provided. If you want to do a simple file search, it's kinda tricky!
Luckily, most installs don't block the shell_exec function, so you can use PHP to execute a grep search through a shell.
Snippet Viewed 1688 times.
Share your PHP code snippets:
- Get some recognition & a link back to your site.
- Create your own code library.
- Help your fellow developers, as they have helped you.