0

How can one automate the creation and deletion process of a php info file?

Automatic deletion is good in case one wants to be covered from cases it forgets to delete the file and then the file is available from browser in some circumstances.

1 Answer 1

1

One can use a cat herestring with at:

document_root=/var/www/html
cat > "$document_root"/info.php <<< "<?php phpinfo();"
echo "rm $document_root/info.php" | at now + 30 minutes

cat concatenates the <?php phpinfo(); code into the info.php file and the file is deleted after 30 minutes which is usually enough to gather the data from it.

You must log in to answer this question.