3

I need to search a large amount of files on my hosting that runs cPanel.

They don't have SSH, is there a way I can run grep in any other way to search my files for a certain piece of text?

2 Answers 2

4
<?php
  $command = "grep -ri 'abcdef' ./*";
  $output = shell_exec($command);
  echo "$output";
  echo "Grep job over.";
?>

Change to suit your required grep search.

Save as grep.php. Then upload to root directory and visit the URL

http://Your Site/grep.php
1
  • It is confusing when you provide solutions that span multiple entries. Commented Oct 20, 2015 at 16:09
0

Yes you can use grep command without shell. First you need to check function is enable shell_exec enable in php.ini then you can use.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.