PHP always writes data to a file
Title, I recently want to write a PHP, is to keep writing data to a file until the disk is full
The requirement is how to get the PHP code to go by itself, without the need for outside action.
------Solution--------------------
If your data volume itself is not very large, now the hard disk is very large, it is not easy AH
------Solution--------------------
Do you want to attack the server? Write files very slow, rather than directly generate large files, execute the copy file ...
------Solution--------------------
PHP can also be converted to execute files, but it is not as direct as C or assembly, writing files is very bad, especially with a very short data constantly to write, directly let the system card that, did not wait for the full to be restarted (now the big hard disk, in that way to write half a long time). Direct operation Fat32/ntfs Generating large files is very fast, and at least writing with large memory buffers is not only faster but also allows the system to respond to some operations without being suspended.
------Solution--------------------
In the dead loop, write it in append mode.
But the first push is always needed. God is too busy to push for you.
------Solution--------------------
PHP will time Out
------Solution--------------------
Reference:
PHP will time out
Yes, you can't just consider the execution method, PHP has a run time limit.
------Solution--------------------
Reference:
PHP will time out
Ignore_user_abort ();
Set_time_limit (0);
------Solution--------------------
Start or need manual ah, script can not self-run!
------Solution--------------------
"Until the disk is full."
Very curious about the intentions of the landlord
------Solution--------------------
This demand ... A bit of a spoof meaning Ah, but always return to say that PHP is not automatically executed, you can use PHP call shell or bat to manipulate the file
------Solution--------------------
PHP timed execution can solve your question.