conryf Posted May 3, 2010 Share Posted May 3, 2010 Hi I'm running php 5.3 on a Ubuntu 10.04 server and I'm having some wierd permissions issues. The most straightforward one is this file: $resource = mysql_query("select * from book_expiration_dates where DATEDIFF(NOW(), expiration_date)"); while( $obj = mysql_fetch_object($resource) ) { $bid = $obj->bid; $ext = $obj->ext; $cat_res1 = mysql_query("select main_genre, filename from books where id=$bid"); $cat_obj1 = mysql_fetch_object($cat_res1); $cat_res2 = mysql_query("select g1.identifier as child, g2.identifier as parent from genres g1, genres g2 where g1.id=" . $cat_obj1->main_genre ." and g1.parent_id=g2.id"); $cat_obj2 = mysql_fetch_object($cat_res2); $unlink_path = "/var/www/content/" . $cat_obj2->parent .'/' .$cat_obj2->child . '/' . $cat_obj1->filename . '.' . strtolower($ext); echo "unlinking $unlink_path<br>"; unlink($unlink_path); } So, all the directories in question are 755, owned by www-data and with group www-data and running it from the command line I get a permissions error. Now if I change the directories permissions to 777 and execute the php file from the command line it can delete the file, however, if I run it in a browser it will not. What baffles me is that I need 777 permission at all since php is the owner of these files. Are there any factors I'm overlooksing? Thanks! Link to comment https://forums.phpfreaks.com/topic/200549-unlink-and-exec-permissions-problems/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.