PHP files executed with the command line can write text to an external text file
First in my Webroot folder (my is: C:\xampp\htdocs\) Create a new folder to put my php file, give this folder name: Externaliotest, and then under this path, namely: C:\xampp\htdocs\ Externaliotest\
Create a Log.txt file, and then create a php file named iotest.php with the following contents:
PHP Code
What this code does is simple: Open the Log.txt and add the current time to the back.
Execute this php file from within the browser via Apache, open connection: http://localhost/externalIOTest/iotest.php
Then open Log.txt, where the text was inserted: 2012-02-06 09:22:36
This shows the code OK.
Then open cmd, go to the C:\xampp\php\ path,
Execution: C:\xampp\php>php.exe-q "C:\xampp\htdocs\exterbalIOTest\iotest.php"
After that, the Log.txt is opened and no text is added to the back.
My question is: how can I do this by Php.exe execute PHP files can also write text to external text files?
Thank you.
------Solution--------------------
It was a long time ago with command-line execution.
Should be the path problem $fp = fopen (' C:\xampp\htdocs\exterbalIOTest\log.txt ', ' A + ');
Try it this way.