title: How can I manipulate extended attributes with PHP?
body: <p>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. </p>
  
  <p>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.</p>
  
  <p>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):</p>
  
  <pre><code>sudo apt-get install libattr1-dev
  </code></pre>
  
  <p>That worked fine. I then installed Pear xattr with:</p>
  
  <pre><code>sudo pecl -v install xattr
  </code></pre>
  
  <p>Which also succeeded and it indicated I had to add this line to php.ini:</p>
  
  <pre><code>extension=xattr.so
  </code></pre>
  
  <p>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:</p>
  
  <blockquote>
    <p>Call to undefined function xattr_supported()...</p>
  </blockquote>
  
  <p>I checked <code>phpinfo()</code> and it indicates xattr support is enabled....</p>
  
  <p>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?</p>
  
  <p>Thanks in advance. </p>