So I have a huge list of text files inside a folder that I must process using a PHP script, and if processing is successful, I need to discard the file. However I only want to attempt 3 times each file, at most. If after the 3rd attempt it fails, I'll discard the file regardless.
So after doing some research I learned about Linux extended file attributes, and that seemed to be a viable way of keeping a counter in each file by means of an extended attribute.
Further research told me PHP supports this with a Pear package named xattr. I then installed the required libattr extension by running this command line (This is an Ubuntu 12.04 system by the way):
sudo apt-get install libattr1-dev
That worked fine. I then installed Pear xattr with:
sudo pecl -v install xattr
Which also succeeded and it indicated I had to add this line to php.ini:
extension=xattr.so
Which I also did and then restarted Apache. But when I attempted to use any of the xattr commands in PHP I always get this:
Call to undefined function xattr_supported()...
I checked phpinfo()
and it indicates xattr support is enabled....
So what am I missing here? Shouldn't xattr_supported() at least return a boolean indicating whether extended attributes are supported by the file system or not? Or, is there any other way I can write random data to a plain text file without altering its contents?
Thanks in advance.