I need to modify the file date change using my php script. At my localhost, I used XAMPP running in Windows 7. I had no problem using PHP touch and is working properly as I want it to be.
Yet, when I uploaded it to my production, LINUX OS the PHP touch
is not working anymore. I investigated it and found that, Linux, doesn't allow PHP touch
or doesn't allow anybody to change file mod date.
That's why I use exec("touch filename.txt") instead and it working properly, but when I use this code
exec("touch -t 201204040000.00 filename.txt");
It doesn't do what it must, am I missing something here?
These are my references:
EDIT
ls -l filename.txt
-rw-r--r-- 1 2012-11-04 12:00 filename.txt //supposed that 2012-11-04 12:00 is the original mod date of the file
If i run this code:
exec("touch filename.txt");
ls -l filename.txt
-rw-r--r-- 1 2012-11-05 11:00 filename.txt //supposed that 2012-11-05 11:00 is the current timestamp
The above code is working properly on me as everyone see. But if i run it like this:
exec("touch -t 201204040000.00 filename.txt");
ls -l filename.txt
-rw-r--r-- 1 2012-11-05 11:00 filename.txt //The mod date doesn't changed at all.