title: Permission denied despite appropriate permissions using PHP
body: <p>I'm trying to read a file in PHP and I'm getting a permission denied error although everybody has read access to the file.</p>
  
  <p><strong>The PHP code:</strong></p>
  
  <pre><code>$config=file_get_contents('/opt/jenkins/home/config.xml');
  </code></pre>
  
  <p><strong>The error:</strong></p>
  
  <pre><code>Warning: file_get_contents(/opt/jenkins/home/config.xml): failed to open stream: Permission denied in [...]
  </code></pre>
  
  <p><strong>The filesystem permission:</strong></p>
  
  <p>There is a symlink pointing <code>/opt/jenkins/home/</code> to <code>/var/lib/jenkins</code> and everybody has read permission on the symlink, actual folder, and file.</p>
  
  <pre><code>$ ls -lh /opt/jenkins/
  lrwxrwxrwx 1 sysadmin sysadmin   16 2011-08-04 08:12 home -&gt; /var/lib/jenkins
  
  $ ls -lh /var/lib/ | grep jenkins
  drwxr-xr-- 6 jenkins adm     4.0K 2011-08-04 10:04 jenkins
  
  $ ls -lh /var/lib/jenkins/config.xml
  -rwxr-xr-- 1 jenkins adm 3.9K 2011-08-04 10:05 /var/lib/jenkins/config.xml
  </code></pre>
  
  <p><strong>Apache configuration</strong></p>
  
  <p>Configured to folllow symlinks (<code>Options All</code>). Adding a <code>Directory</code> directive for <code>/var/lib/jenkins/</code> makes no difference.</p>
  
  <pre><code>&lt;Directory /opt/jenkins/home/&gt;
          Options All
          AllowOverride All
          Order Allow,Deny
          Allow from All
  &lt;/Directory&gt;
  </code></pre>
  
  <p><strong>Additional info</strong></p>
  
  <p>Whether I use the path through the symlink (<code>"/opt/jenkins/home/config.xml"</code>) or the real path (<code>"/var/lib/jenkins/config.xml"</code>) I have the same problem.</p>
  
  <pre><code>apache2 version=2.2.14-5ubuntu8.4
  php version=5.3.2-1ubuntu4.9
  </code></pre>
  
  <p><strong>Any idea as to why I'm getting the error?</strong></p>