in Software by (10.1k points)
0 like 0 dislike
How to display php output on a txt file in Linux command line?

php script output in file in terminal

1 Answer

0 like 0 dislike
by (10.1k points)

If your php script writes output to STDOUT stream, then you can run your php script like this:

php /path/script.php > /path/file.txt

I.e. you just run script and redirect it to the .txt file.

Also you can use php function file_put_contents() in php script:

file_put_contents('your file', 'your data')

Your answer

Try to answer the question as detailed as possible.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.