title: PHP Symlink Permission Denied
body: <p>I know this question is asked a lot, but I can't seem to find the error why my symlinks sometimes aren't working.</p>
  
  <p>I have two folders:</p>
  
  <pre><code>/home/user/domains/example.com/folder1
  /home/user/domains/example.com/folder2
  </code></pre>
  
  <p>These are their permissions:</p>
  
  <pre><code>drwx--x--x  9 root   root   4096 May 12 11:15 home
  drwx--x--x  7 user   access 4096 Feb  9 10:23 user
  drwx--x--x  3 user   user   4096 May  5  2014 domains
  drwx--x--x 12 user   user   4096 Jul  7 09:52 example.com
  drwxr-xr-x  2 apache apache 4096 Jan 21 09:22 folder1
  drwxrwxrwx  4 user   user   4096 Jul  9 10:38 folder2
  </code></pre>
  
  <p>in PHP I create two symlinks:</p>
  
  <pre><code>symlink("/home/user/domains/example.com/folder1","whatever/folder");
  symlink("/home/user/domains/example.com/folder2","whatever/folder");
  </code></pre>
  
  <p>Why is my symlink to folder1 working and my symlink to folder 2 not? I have been looking at it for hours now..</p>
  
  <p>Edit:
  Well, as my provider isn't of any help, I'd like to try a different solution: create a symlink and immediately change its owner. This, however, gives me an 'Operation not permitted' error. Any ideas on that?</p>