PHP write outside document root
问题 I'm trying to create a file in a directory outside the document root of the web server. The folder has permissions 777 but php says Permission Denied: Warning: fopen(/home/site2/public_html/images/x.jpg) [function.fopen]: failed to open stream: Permission denied in /home/site1/public_html/test_sites.php on line 2 Permission problem <?php $f = fopen('/home/site2/public_html/images/x.jpg', 'wb'); if(!$f) die("Permission problem"); fclose($f); echo "OK"; ?> 回答1: The 777 permissions is half the