Question

I have recently switched from a website hosted on a normal webhost to a linode virtual server which I installed all of the appropriate bits and pieces to. I moved my code over and everything in my complex web-application works except my image uploader - it is failing to create new folders.

I have gone ahead and placed this in the code to debug

$uid = "Blahblahblah";
$thisdir = getcwd() . "/" . $uid . "/"; 

if(mkdir($thisdir , 0777)) 
{ 
   echo "Directory has been created successfully..."; 
} 
else 
{ 
   echo "Failed to create directory..."; 
   echo " this dir Variable is:'" . $thisdir . "'" ;
} 

which is outputting

Failed to create directory... this dir Variable is:'/home/jhstaffo/public/firstclassresearch.com/public/shopper/Blahblahblah/'

Why is this happening - is it a server setting or something wrong with my code? What is going on?

Was it helpful?

Solution

it appears the accurate way to deal with this in a ubuntu server assuming apache is running using user www-data - this now functions appropriately

chown -R www-data:www-data /home/jhstaffo/public/firstclassresearch.com/public
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top