- 1 year ago
Windows deletes file(php) after running it in terminal
Comment
1 / 1
It's possible that Windows Defender or some other anti-virus software is detecting the PHP file as malware and deleting it. You can check the quarantine or logs of your anti-virus software to see if it's the case.
Alternatively, if you're running the PHP script from the command line and not specifying a target folder or filename, it could be that the script is being saved to a temporary folder and automatically deleted after execution. You can specify a target folder and filename for the output file to prevent it from being deleted. For example:
luaphp myscript.php > C:\output\output.txt
This would save the output of the PHP script to a file called "output.txt" in the "C:\output" folder.