asked in Software by (8.9k points)
0 like 0 dislike
17 views
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
answered by (8.9k 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.

Related questions

0 like 0 dislike
1 answer 33 views
0 like 0 dislike
1 answer 15 views
0 like 0 dislike
1 answer 31 views
0 like 0 dislike
1 answer 41 views
0 like 0 dislike
1 answer 12 views
0 like 0 dislike
1 answer 16 views
0 like 0 dislike
1 answer 10 views
0 like 0 dislike
1 answer 12 views
...